|
Search:
Advanced search
|
Browse by category:
|
Contact Us |
Running php4 and php5 together in server |
|||||
Normally, there will be one version of php in server that is running as Apache API. We can configure another version of php for a domain, and we run this php as CGI.
In this article, I assume that php4 is running server wide and configured as Apache API. We will configure php5 as CGI for a domain say domain.com with DocumentRoot /home/user/public_html. The server wide php4 will be installed either in /usr or /usr/local folder. We will install the new php5 into a different folder say, /usr/local/php5 Following are the steps 1. Download, compile and install the source. cd /usr/local/src tar -xjf php-5.2.3.tar.bz2 cd php-5.2.3 ./configure --prefix=/usr/local/php5 --exec-prefix=/usr/local/php5 --with-mysql make make install In the above example, I compiled php5 with only mysql support. You need to specify other options if you need support for them. It will install the php5 into the folder /usr/local/php5. You will be able to see the following folders, if the compilation is successfull. bin/ etc/ include/ lib/ man/ and inside the bin/ folder you will have the required binaries. 2. Configure Apache to use php5 for domain.com domain. Add the following Directory tab outside the VirtualHost entry for domain.com. <Directory /home/user/public_html> AddHandler php-script .php Action php-script /cgi-bin/php-cgi </Directory> Now, if any php file in that domain is referenced, it will use the php-script handler to process the php file. The action script specified in the above example is under the cgi-bin folder. So we need to copy the php cgi binary into that folder. cp /usr/local/php5/bin/php-cgi /home/user/public_html/cgi-bin/ We are done! The configuration of new php can be verified by putting a phpinfo page in that domain. Tips: If apache is looking for the php binary in folder /usr/local/apache/ folder, you need to copy that php-cgi binary into the cgi-sys folder. |
|||||
Powered by
Deru Communications (Webhosting Knowledgebase)