1 2 3 4 5 6
| sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install php5.6
you can install more php5.6 module sudo apt-get install php5.6-fpm php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-intl php-apcu php-uuid php5.6-cgi php5.6-cli php5.6-gd php5.6-ldap php5.6-sqlite3 php-uploadprogress libapache2-mod-php5.6
|
php7.2与php5.6版本切换
1 2 3
| a2dismod php7.2 a2enmod php5.6 systemctl restart apache2
|
默认没有开启PHP 5.6 FPM
,为了开启PHP 5.6 FPM
,需要执行一下命令
1 2
| a2enmod proxy_fcgi setenvif a2enconf php5.6-fpm
|
同时执行如下命令
最后重启apache
1
| systemctl reload apache2
|
以上命令是Apache上PHP版本切换的命令,下面是CLI端切换的命令
1 2 3
| sudo update-alternatives --set php /usr/bin/php7.2 sudo update-alternatives --set phpize /usr/bin/phpize7.2 sudo update-alternatives --set php-config /usr/bin/php-config7.2
|