I have installed php 5.6 and and php7.1 on my ubuntu 16.04
I know with apache as my web server, i can do
a2enmod php5.6 to enable php5
a2enmod php7.1 to enable php7
When i disable php7.1 in apache modules and enable php5.6, apache recognizes the change and uses php5.6 interpreter as expected.
But when i run internal php web server from the commandline :-
php -S localhost:8888
php handles requests using php7 , how do i switch between php6.6 and php7.1 in the commandline ?
From PHP 5.6 => PHP 7.1
for old linux versions
for more recent version
To list all available versions and choose from them :
Or do manually
You can use the below script to switch between PHP version easily I have included phpize configuration too.
https://github.com/anilkumararumulla/switch-php-version
Download the script file and run
Interactive switching mode
sudo update-alternatives --config php
Manual Switching
From PHP 5.6 => PHP 7.1
Default PHP 5.6 is set on your system and you need to switch to PHP 7.1.
Apache:
Command Line:
From PHP 7.1 => PHP 5.6
Default PHP 7.1 is set on your system and you need to switch to PHP 5.6.
Apache:
Command Line:
Source
Type given command in your terminal..
For disable the selected PHP version...
For enable other PHP version....
It will upgrade Php version, same thing reverse if you want version downgrade, you can see it by PHP_INFO();
I think you should try this
From php5.6 to php7.1
From php7.1 to php5.6