Notes some problems on run more than one PHP version on Ubuntu.
There are still some questions about how PHP, PHP CLI, Web Server Apache2, Nginx, PHP-FPM (FastCGI), composer ...
Switch PHP version with Apache2
https://askubuntu.com/questions/761713/how-can-i-downgrade-from-php-7-to-php-5-6-on-ubuntu-16-04
https://tecadmin.net/switch-between-multiple-php-version-on-ubuntu/
The basic idea for run 2 (or more ?) PHP version with Nginx and PHP-FPM is each FPM run on different port (9000, 9001) if use TCP/IP mode.
In case use eg. php5-fpm.sock then you can point to different php-version.sock
Keyword "Pool", Each pool for each PHP, FPM version seem have to different.
If you use default pool (www) then I see that php-fpm only run for one version ie. php7.0-fpm while php5-fpm CGI not run.
Use PHP7 with apache2 and PHP5 with Nginx.
Apache2 can be switch PHP version by a2enmod, dismod to use PHP module.
PHP with Apache is module. PHP in CLI is different story.
This will affect composer.
So we have to really understand the way language, PHP processor, Linux and Web server work.
Install different version
https://www.tecmint.com/install-different-php-versions-in-ubuntu/
Set default PHP version in Ubuntu
------------ Set Default PHP Version 5.6 ------------
$ sudo update-alternatives --set php /usr/bin/php5.6
https://www.tecmint.com/install-different-php-versions-in-ubuntu/
Update 1:
When switch/set default PHP version both APC and nginx, after that we have to install and / or remove some lib like php-mysql, curl ... I don't know why default or php7.0 mysql is lost.
So after switch to 5.6 for example and back, server not work as before.
After many trial and error I figure out that it is caused by mis lib php-mysql The common when install php.
It is pschological that prevent me to clear on investigate problem.
PS: Remember update port 9000 in ie. php/5.6/fpm/pool.d/www.conf etc
In real situation it easier to expose problems. If we trying to test multiple version affect, it require a clever setup both multi project cover as much problems as posible.
There are still some questions about how PHP, PHP CLI, Web Server Apache2, Nginx, PHP-FPM (FastCGI), composer ...
Switch PHP version with Apache2
https://askubuntu.com/questions/761713/how-can-i-downgrade-from-php-7-to-php-5-6-on-ubuntu-16-04
https://tecadmin.net/switch-between-multiple-php-version-on-ubuntu/
The basic idea for run 2 (or more ?) PHP version with Nginx and PHP-FPM is each FPM run on different port (9000, 9001) if use TCP/IP mode.
In case use eg. php5-fpm.sock then you can point to different php-version.sock
Keyword "Pool", Each pool for each PHP, FPM version seem have to different.
If you use default pool (www) then I see that php-fpm only run for one version ie. php7.0-fpm while php5-fpm CGI not run.
Use PHP7 with apache2 and PHP5 with Nginx.
Apache2 can be switch PHP version by a2enmod, dismod to use PHP module.
PHP with Apache is module. PHP in CLI is different story.
This will affect composer.
So we have to really understand the way language, PHP processor, Linux and Web server work.
Install different version
https://www.tecmint.com/install-different-php-versions-in-ubuntu/
Set default PHP version in Ubuntu
------------ Set Default PHP Version 5.6 ------------
$ sudo update-alternatives --set php /usr/bin/php5.6
https://www.tecmint.com/install-different-php-versions-in-ubuntu/
Update 1:
When switch/set default PHP version both APC and nginx, after that we have to install and / or remove some lib like php-mysql, curl ... I don't know why default or php7.0 mysql is lost.
So after switch to 5.6 for example and back, server not work as before.
After many trial and error I figure out that it is caused by mis lib php-mysql The common when install php.
It is pschological that prevent me to clear on investigate problem.
PS: Remember update port 9000 in ie. php/5.6/fpm/pool.d/www.conf etc
In real situation it easier to expose problems. If we trying to test multiple version affect, it require a clever setup both multi project cover as much problems as posible.
Comments
Post a Comment