On 10/10/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi, > > Is it possible to have php4 and php5 installed into > the same apache installation telling apache that > some files should be executed using php4 and some > others using php5 even if they all have the same > extension (.php)? > > I'm thinking about 2 virtual hosts or applying some > directory rules or listening to different ports... > but not sure.... > > We'll use Windows 2000 + Apache 2. > > Thanks ;-) > > I'm doing that on my home windows box which isn't exposed outside the local network so it doesn't have the very latest versions of php but here's what I did which works on my pc: I put php4 in one directory and php5 in another you can see where in the hhtp.conf excerpts below. So it ends up with reading C:\WINNT\php.ini for php4 and K:\php- 5.2.0\ini\ctb\php.ini for php5 php4 is running as an apache moduke and php5 as CGI but you might well do it the other way around.
As an aside be warned that PHP4 is reaching endof life 12/21/07 and has numerous serious bugs present even in the latest version. These are fixed in the latest version of PHP5 so don't plan on having php4 hanging around for long. OK here's the relevant sections in http.conf: #LoadModule php5_module "K:\php-5.2.0\php5apache.dll" LoadModule php4_module "K:\php-4.4.4-Win32\php4apache.dll" ... #AddModule mod_php5.c AddModule mod_php4.c ... NameVirtualHost 127.0.0.1:80 <VirtualHost 127.0.0.1:80> ServerName localhost DocumentRoot "I:\Program Files\Apache Group\Apache\htdocs" SetEnv PHPRC "K:/php-4.4.4-Win32" </VirtualHost> <VirtualHost 127.0.0.1:80> ServerName ctb DocumentRoot "I:/Program Files/Apache Group/Apache/htdocs/php5dir" ServerAdmin [EMAIL PROTECTED] DirectoryIndex index.php index.html index.htm SetEnv PHPRC K:/php-5.2.0/ini/ctb # you need this next line to make the action line below work ScriptAlias /php/ "K:/php-5.2.0/" AddHandler php5-script .php .html Action php5-script "/php/php-cgi.exe" ErrorLog logs/error.cttb.log CustomLog logs/access.cttb.log combined </VirtualHost> ------------------- and in my hosts file 127.0.0.1 localhost 127.0.0.1 ctb so that I can access each so: for PHP4 http://localhost/ for PHP5 http://ctb/ Hope this helps.
