Use php5 and php4 on Same Apache Server
A while back at work I needed to use php5 for a site that was hosted on a machine that uses Apache’s mod-php4. Since I needed to keep php4 for the rest of the sites hosted on this machine, I needed to find a way to enable php5 for just one virtual host. It turned out to be a relatively easy thing to do. I just needed to install the php5 CGI package and tell Apache to use CGI for php files on that particular virtual host. Here is how I accomplished this on our Debian server:
Installation
apt-get install php5-cgi Then, I needed to edit the configuration for the virtual host:
Configuration
<VirtualHost *:80 *:443>
# ... site configuration stuff ...
# set up cgi-bin
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
# use CGI php5 for .php files
AddHandler php5-script .php
Action php5-script /cgi-bin/php5
</VirtualHost>
That’s it! Now the site will use php5, and life is good. If performance of vanilla CGI is a concern, FastCGI is definitely an option.
© 2009 by p@rrish blog
Powered by WordPress | Designed for Chungo by Cordobo