Cara Install Multi PHP 5 dan 7 di Virtualmin

Cara Instal PHP 5.6/7 di CentOS 6 dan 7

# yum install centos-release-scl
PHP 5.6 # yum install rh-php56 rh-php56-php-mysqlnd
PHP 7    # yum install rh-php70 rh-php70-php-mysqlnd

 

Cara Install PHP 7 di Debian dan Ubuntu 14.04

# add-apt-repository ppa:ondrej/php && apt-get update
# apt-get install php7.0 php7.0-mysql php7.0-cgi php7.0-cli

Reset default PHP ke to PHP5 (optional)

update-alternatives --set php /usr/bin/php5

 

Cara Check Semua PHP yang terinstall

System Settings -> Re-Check Config.

The following PHP versions are available : 5.3.3 (/usr/bin/php-cgi), 5.6.25 (/opt/rh/rh-php56/root/usr/bin/php-cgi), 7.0.10 (/opt/rh/rh-php70/root/usr/bin/php-cgi)

 

Sert Versi PHP Default

System Settings -> Server Templates -> Default -> Apache Website

 

Setting Per Virtual Servers

Pilih salah satu Virtual Server dan klik  Server Configuration -> PHP Versions. Dapat juga di-setting per folder.

 

INSTALL SINGLE PHP

Dalam beberapa kasus jika diperlukan untuk memakai 1 versi PHP saja atau ingin menganti versi PHP terkecil dengan yang terbaru (misal PHP 5.4 dibuang dan install PHP 5.6 sebagai versi terkecil) maka caranya:

  1. yum update dan run yum clean all
  2. yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
  3. yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
  4. yum install yum-utils
  5. nano /etc/yum.repos.d/remi.repo dan aktifkan (enable=1) PHP56
  6. yum check-update (untuk memeriksa perubahan/update apa saja antara PHP 5.4 dan 5.6)
  7. yum remove php-*
  8. bisa saja anda jalankan yum install php-* tapi sebaiknya dilakukan 1 per satu sesuai kebutuhan, yaitu: yum install php-cli, yum install php-mysql, dst
  9. systemctl restart httpd
  10. Lakukan permbersihan ulang: yum update dan yum clean all
  11. Check versi PHP # php -v

 

Semoga bermanfaat.