LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   [How to] - Multiple PHP version in Apache (https://www.linuxquestions.org/questions/linux-server-73/%5Bhow-to%5D-multiple-php-version-in-apache-4175416434/)

tquang 07-12-2012 10:45 PM

[How to] - Multiple PHP version in Apache
 
Hi,

I have problem in deploy multiple PHP version (5.2.1 and 5.3.3) in one Apache.

Here my 5.2 configure
Code:

./configure --prefix=/usr/local/php52 --with-apxs2=/usr/local/apache/bin/apxs
make
make install
mv /usr/local/apache/modules/libphp5.so /usr/local/apache/modules/libphp52.so

And below my 5.3 configure
Code:

./configure --prefix=/usr/local/php53 --with-apxs2=/usr/local/apache/bin/apxs
make
make install
mv /usr/local/apache/modules/libphp5.so /usr/local/apache/modules/libphp53.so

If I add 2 line in httpd.conf, then restart
Code:

LoadModule php5_module        modules/libphp52.so
LoadModule php5_module        modules/libphp52.so

=> Noticed: dulicated modules.

But, if i modify like as
Code:

LoadModule php52_module        modules/libphp52.so
LoadModule php53_module        modules/libphp5.so

=> Noticed: not identified modules name.

So, I have 2 question to ask:
_How can I rename module php_module to php52_module or php53_module: before compile from source PHP (edit file??) ?
_And how config Apache can run multiple PHP version in mod_php function?

I was tried searching on Google, but not found, because guide base on fastCGI, i want to use mod_php.

Thanks a lot!

emi_ramo 07-13-2012 09:28 AM

Hi there,
As far as I know, you can only have one version of PHP for each Apache server. If oyu need more than one version, you'll need a second Apache server running on different port than first and, probably, using a ProxyPass/ProxyReverse on first one.

Hope it helps,
emi

lithos 07-13-2012 11:29 AM

There have been some examples of using multiple PHP versions on the same server.

good luck

tquang 07-13-2012 09:34 PM

emi_ramo and lithos
Thank you very much!

And i want to reconfig default module name PHP:
_How can I rename module php_module to php52_module or php53_module: before compile from source PHP (edit file??) ?

lithos 08-12-2012 03:44 AM

Hi,

well, I wouldn't know how to compile it with a different name, but "php5_module" is an Apache configuration name for which it will load a PHP library
like
Code:

# Use for PHP 5.x:
LoadModule php5_module        modules/libphp5.so

and in the link I posted before, there is the option where the library will install
Code:

# Build and install php-5.3 with fpm enabled

wget http://cn.php.net/get/php-5.3.6.tar.bz2/from/this/mirror
tar -xjf php-5.3.6.tar.bz2
cd php-5.3.6
./configure --prefix=/usr/local/php53


jigarakatidus 02-05-2013 04:49 AM

Hi,

I am trying to do the same thing.

I could only find for running PHP 4 and PHP 5 here. Since the module names are different I think its possible but with same module name php5_module we dont any option but to change the module name.

Any updates on this ?


All times are GMT -5. The time now is 07:35 AM.