Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have compiled all Apache, PHP 5.2 and PHP 5.3 on CentOS at path /usr/local/apache, /usr/local/php52 and /usr/local/php53.

I have the libphp5.so modules in my respective php folder by using symlink at /usr/local/php and LoadModule directive. I am able to switch PHP versions too but now I want that different directories to run with different PHP 5.x version. Is it possible ?

I have seen posts like this one where running PHP4 and PHP5 together is possible but in my case module name php5_module is same in both the versions, apache isn't loading the second Module.

Also I have seen some posts like this one where they are using different SAPI e.g PHP-FPM, Fast-CGI which I am avoiding.

So I am left with only option to rename the module php5_module to php53_module or something similar.

I tried editing the source with no success. Here is what I did : Replaced string mod_php5 with mod_php53, libphp5 with libphp53, php5_module with php53_module, application/x-httpd-php with application/x-httpd-php53 all this were replaced in all files of the source.

I used similar command to replace strings recursively

find . -name '*.php' -type f -exec sed -i 's/x-httpd-php/x-httpd-php53/' {} \;

configure command was completed successfully but make did not complete, following is the error :

 /setups/src/php-5.3.21/sapi/apache2handler/sapi_apache2.c: In function 'php_apache_ini_dtor':
/setups/src/php-5.3.21/sapi/apache2handler/sapi_apache2.c:522: error: 'php53_module' undeclared (first use in this function)
/setups/src/php-5.3.21/sapi/apache2handler/sapi_apache2.c:522: error: (Each undeclared identifier is reported only once
/setups/src/php-5.3.21/sapi/apache2handler/sapi_apache2.c:522: error: for each function it appears in.)
/setups/src/php-5.3.21/sapi/apache2handler/sapi_apache2.c: In function 'php_handler':
/setups/src/php-5.3.21/sapi/apache2handler/sapi_apache2.c:550: error: 'php53_module' undeclared (first use in this function)
make: *** [sapi/apache2handler/sapi_apache2.lo] Error 1

BTW OS I am using is CentOS.

share|improve this question

1 Answer 1

I do not think it is possible to do this the way you are thinking though I could be wrong.

An alternative is to use something like fastcgi but there will be a performance hit.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.