Installing multiple versions of PHP on an Ubuntu server

Initial situation:

I have a Ubuntu 12.04 server that hosts 3 websites (with Apache 2.2.22)

How can I install a different version of PHP for only one of the sites? (The remaining 2 should remain as they are)

Current PHP Version: PHP 5.3.10; Desired PHP Version: PHP 5.6.16

What I have done / understood so far:

I already tried PHPBrew: http://phpbrew.imtqy.com/phpbrew/

I managed to install PHP 5.6.16 for the command line (with PHPBrew), but Apache still uses PHP 5.3.10.

I realized that in the end there should be a * .so file that needs to be placed in the / etc / apache 2 / httpd.conf file. (this file is currently empty) (via LoadModule ...)

But: I do not have * .so files. I installed PHPBrew as follows:

phpbrew install 5.6.16 + default + mysql + mcrypt

I think I should have added + apxs2 = / usr / bin / apxs2, but if I do, I get the error "Exception: the apxs binary is not executable: / usr / bin / apxs2".

How can i fix this?

Or is there a better way to run different versions of PHP on the same server? What is the best way?

+4
source share
1 answer

Double check the files .so, they should be in `/ usr / lib / apache2 / modules /` `

Then you must edit /etc/apache2/mods-enabled/php5.loadand specify the file .sothat matches your installation, in your case:

LoadModule php5_module /usr/lib/apache2/modules/libphp5.6.16.so

PHP Docker, . : PHP

, PHP .

+1

Source: https://habr.com/ru/post/1620421/


All Articles