Re: multiple php version

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Tue, Apr 1, 2008 at 3:26 AM, Marco Strullato <marco.strullato@xxxxxxxxx> 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
<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 php.5
DocumentRoot "I:/Program Files/Apache Group/Apache/htdocs/php5"
ServerAdmin webmaster@xxxxxxxx
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.


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux