You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Marco Strullato <ma...@gmail.com> on 2008/04/01 12:26:01 UTC

[users@httpd] multiple php version

hi all,
I'd like to use two version of php into the same apache server.
I've loaded both modules,but I don't know how to choose between different
versions of php...
more: is it possible to let a virtualhost to use only a particular version
of php?

thanks

marco

Re: [users@httpd] multiple php version

Posted by j k <jo...@gmail.com>.
On Tue, Apr 1, 2008 at 3:26 AM, Marco Strullato <ma...@gmail.com>
wrote:

> hi all,
> I'd like to use two version of php into the same apache server.
> I've loaded both modules,but I don't know how to choose between different
> versions of php...
> more: is it possible to let a virtualhost to use only a particular version
> of php?
>
> thanks
>
> marco
>
>  This may help:
http://www.howtoforge.com/apache2_with_php5_and_php4
 and also a google search using
'install both php4 and php5' gets a good number of hits.

I've done it on both windows and gentoo linux.
On linux I used the gentoo wiki guide and was using php susffix for php4 and
php5 suffixe for php5 files, i.e., they were the same in all virtual hosts.

On windows I used the SetEnv, ScriptAlias, AddHandler  and Action directives
within a <virtualhost> block to set which php version was used.
Here are some snippets out of that latter httpd.conf file some of which you
may not need

#LoadModule php5_module "K:\php-5.2.0\php5apache.dll"
LoadModule php4_module "K:\php-4.4.4-Win32\php4apache.dll"

SetEnv PHPRC "K:/php-4.4.4-Win32"
#SetEnv PHPRC K:/php-5.2.0/ini/php.5
#SetEnv PHPRC K:/php-5.2.0


#AddModule mod_php5.c
AddModule mod_php4.c


<IfModule mod_mime.c>
    TypesConfig conf/mime.types
    AddType application/x-httpd-php .php
    SetEnv PHPRC K:/php-4.4.4-Win32
</IfModule>

    ### replace with your PHP4/5 directory  ## didn't work for /php5/ gave:
# The requested URL /php/php-cgi.exe/1.php was not found on this server.
# so I expanded it out
#    ScriptAlias /php4/ "K:/php-4.4.4-Win32/"
#    ScriptAlias /php5/ "K:/php-5.2.0/"




###
#Action application/x-httpd-php "/php/php-cgi.exe"
##
# specify the directory where php.ini is
#SetEnv PHPRC K:\php-5.2.0\ini\php.5


NameVirtualHost 127.0.0.1:80 <http://127.0.0.1/>
<VirtualHost 127.0.0.1:80 <http://127.0.0.1/>>
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 <http://127.0.0.1/>>
ServerName php.5
DocumentRoot "I:/Program Files/Apache Group/Apache/htdocs/php5"
ServerAdmin webmaster@php5.com
DirectoryIndex index.php index.html index.htm
SetEnv PHPRC K:/php-5.2.0/ini/php.5
## 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/errorphp.5.log
CustomLog logs/accessphp.5.log combined
</VirtualHost>

Hope that helps.