1
2
| sudo apt-add-repository -y ppa:ondrej /php sudo apt-get -y update |
3
| sudo apt-get -y install php7.0 php5.6-mysql
php5.6-cli php5.6-curl php5.6-json php5.6-sqlite3
php5.6-mcrypt php5.6-curl php-xdebug php5.6-mbstring
libapache2-mod-php5.6 libapache2-mod-php7.0
mysql-server-5.7 apache2 |
4
| sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart ; echo 1 | sudo update-alternatives --config php |
5
| sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart ; echo 2 | sudo update-alternatives --config php |
6
7
| alias phpv5= 'sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart ; echo 1 | sudo update-alternatives --config php'
alias phpv7= 'sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart ; echo 2 | sudo update-alternatives --config php' |
8
9
10
| sudo a2dismod mpm_event sudo a2enmod mpm_prefork sudo service apache2 restart |
參考網站:https://www.phpini.com/php/ubuntu-16-04-xenial-xerus-apache-mysql-php-lamp