Dear Wiki user, You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change notification.
The following page has been changed by pctony: http://wiki.apache.org/httpd/ScratchPad/PHP4AndPHP5 ------------------------------------------------------------------------------ == Guide to enabling both PHP4 and PHP5 in different vhosts == - We often see people asking how to enable both PHP4, and PHP5 for different vhosts. This can be done, if you follow the Apache recommended method of enabling PHP in the first place.[[BR]] + We often see people asking how to enable both PHP4, and PHP5 for different vhosts. This can be done if you follow the Apache recommended method of enabling PHP in the first place. There is a very popular misconception that people should use {{{AddType}}} to enable PHP. This will not work in this scenario is not recommended.[[BR]] We won't tell you how to install PHP, but you need to make sure that you select different install locations for each version. You then need to maintain a separate copy of {{{php.ini}}} for each install. The PHP modules should be loaded by having something similar to this in your {{{httpd.conf}}} @@ -40, +40 @@ AddHandler application/x-httpd-php .php .phtml Action application/x-httpd-php modules/libphp.so </VirtualHost> + + <VirtualHost *:80> + ServerName www.example3.com + DocumentRoot /usr/local/apache2/htdocs/example3 + + Include /usr/local/apache2/conf/php4.conf + </VirtualHost> }}} You will notice that in vhost 1, we did not specify a version of PHP to use, this it used the system global version. @@ -48, +55 @@ There are several ways to use these options: 1. Set a global default, i.e. PHP5, then using {{{RemoveHandler}}} specify each vhost that needs to use PHP4. - 2. Set each each vhost to use a specific version, i.e. Not using a global default. (You could use an {{{Include}}} statement for that) + 2. Set each each vhost to use a specific version, i.e. Not using a global default. (You could use an {{{Include}}} statement for that, as in example vhost 3, where you would include all the required PHP4 directives)
