我已经安装了 php7,但是 phpinfo() 显示的是 php5
控制台向我展示 php -v
php -v
jaskaran@jaskaran-OptiPlex-3020:/etc$ php -v
PHP 7.1.0RC6 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.1.0RC6, Copyright (c) 1999-2016 , by Zend Technologies
phpinfo(); //output
PHP Version 5.5.9-1ubuntu4.20
在 php 文件夹中 PHP 7.1
jaskaran@jaskaran-OptiPlex-3020:/etc$ cd php
php/ php5/ phpmyadmin/
jaskaran@jaskaran-OptiPlex-3020:/etc/php$ ls
5.5 5.6 7.0 7.1
现在我可以将我的 php 版本从 apache2 php5 移到 php7 吗
答案1
打开终端
cd /etc/apache2/mods-enabled
sudo a2dismod php5
sudo rm php5.load
sudo rm php5.conf
sudo a2enmod php7.0
sudo ln -s php7.0.conf ../mods-available/php7.0.conf
sudo ln -s php7.0.load ../mods-available/php7.0.load
sudo a2enconf php7.0-cgi
sudo a2enconf php7.0-fpm
# do those commands only if the above didn't work out
sudo ln -s php7.0-cgi.conf ../conf-available/php7.0-cgi.conf
sudo ln -s php7.0-fpm.conf ../conf-available/php7.0-fpm.conf
sudo service apache2 restart