multiple php compiler on single apache installation
        Posted  
        
            by 
                getmizanur
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by getmizanur
        
        
        
        Published on 2010-12-19T19:43:00Z
        Indexed on 
            2011/01/06
            21:55 UTC
        
        
        Read the original article
        Hit count: 634
        
elloo,
i have some old php scripts which runs on php-5.2.x and the current server has php-5.3.x. to get around this problem,i have got two options one is to downgrade php-5.3.x or install php-5.2.x and php-5.3.x at the same time where php-5.2.x serve cgi script. i have decided go for the second option
i have followed this tutorial and i can get most of it working however except execution of shell script which selects php-cgi version. i cannot get apache to execute this script.
how do i get apache to execute
#!/bin/sh
# you can change the PHP version here.
version="5.2.6"
# php.ini file location, */php-5.2.6/lib equals */php-5.2.6/lib/php.ini.
PHPRC=/etc/php/phpfarm/inst/php-${version}/lib/php.ini
export PHPRC
PHP_FCGI_CHILDREN=3
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
# which php-cgi binary to execute
exec /etc/php/phpfarm/inst/php-${version}/bin/php-cgi
my apache vhost.conf
<VirtualHost *:80>
    ServerName 526.localhost
    DocumentRoot /home/getmizanur/public_html/www
    <Directory "/home/getmizanur/public_html/www">
        AddHandler php-cgi .php
        Action php-cgi /php-fcgi/php-cgi-5.2.6
    </Directory>
</VirtualHost>
can some one tell me what am i doing wrong?
thanks in advance.
solution: if i did a2dismod php5 then the above configuration worked. when a2enmod php5 had been activated, apache was executing php5.3 instead of php5.2 even after telling apache to execute php5.2 shell script. to solve my problem, i had to change my virtualhost configuration
<VirtualHost *:80>
    ServerName 526.localhost
    DocumentRoot /home/getmizanur/public_html/www
    DirectoryIndex index.php
    <Directory "/home/getmizanur/public_html/www">
        AddHandler php-cgi .php
        Action php-cgi /php-fcgi/php-cgi-5.2.6
        <FilesMatch "\.php">
            SetHandler php-cgi
        </FilesMatch>
    </Directory>
</VirtualHost>
presto, it started working.
© Server Fault or respective owner