Reputation: 753
After I have updated php5 to/and installed PHP 7.
When I run php -v
:
PHP 7.0.23-1+ubuntu14.04.1+deb.sury.org+1 (cli) (built: Aug 31 2017 12:52:39) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache **v7.0.23**-1+ubuntu14.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies
But my phpinfo() still on :
PHP Version 5.5.31-2+deb.sury.org~trusty+1
What should I do to work on PHP7 and not PHP5?
Upvotes: 2
Views: 1686
Reputation: 29
Easiest command with recommended php-apache modules -
//update/upgrade from php5 or php7.0 to php7.1
php -v
sudo apt install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php7.1
sudo apt install php7.1-cli php7.1-xml php7.1-mysql
sudo update-alternatives --set php /usr/bin/php7.1
sudo apt-get install php7.1-gd
sudo apt-get install php-mbstring php7.1-mbstring php-gettext libapache2-mod-php7.1
sudo apt-get install php7.1-json
sudo apt-get install php7.1-soap
sudo service apache2 restart
sudo a2dismod php7.0
sudo a2enmod php7.1
sudo service apache2 restart
php -v
Upvotes: 0
Reputation: 2468
It is because your PHP CLI version is 7 but web is using 5.5
From php5.x to php7.0:
Web:
sudo a2dismod php5.x ; sudo a2enmod php7.0 ; sudo service apache2 restart
CLI:
sudo update-alternatives --set php /usr/bin/php7.0
From php7.0 to php5.x:
Web:
sudo a2dismod php7.0 ; sudo a2enmod php5.x ; sudo service apache2 restart
CLI:
sudo update-alternatives --set php /usr/bin/php5.x
In place of x you have to use particular version ex 5.6
Upvotes: 5