多个PHP版本作为CGI运行

我试图安装PHP的第二个版本,与当前版本的PHP一起运行。 我已经从github(5.5-DEV)编译了最新的php源代码,并且正在尝试将其作为CGI运行。

这是我的虚拟主机configuration:

<VirtualHost *:8055> DocumentRoot /Library/WebServer/Documents/ ScriptAlias /cgi-bin/ /usr/local/php55/cgi Action php55-cgi /cgi-bin/php-cgi AddHandler php55-cgi .php <Directory /Library/WebServer/Documents/> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order Allow,Deny Allow from all </Directory> DirectoryIndex index.html index.php </VirtualHost> 

但是当我去http://127.0.0.1:8055/info.ph p,我得到以下错误:

被禁止

You don't have permission to access /cgi-bin/php-cgi/info.php on this server

编辑

我现在正在切换

 LoadModule php5_module /usr/local/php54/libphp5.so 

 LoadModule php5_module /usr/local/php55/libphp5.so 

它现在工作,但不理想。 我想在不同的虚拟主机上有不同版本的php

你需要告诉Apache如何处理系统的新的/usr/local/php55目录。

 <Directory /usr/local/php55/cgi> Allow from all </Directory> 

您可能需要在ScriptAlias分配的末尾添加一个额外的“ / ”,或者Action可能会parsing为

 Action php55-cgi /usr/local/php55/cgiphp-cgi 

所以你的虚拟主机块会读作:

 <VirtualHost *:8055> DocumentRoot /Library/WebServer/Documents/ ScriptAlias /cgi-bin/ /usr/local/php55/cgi/ Action php55-cgi /cgi-bin/php-cgi AddHandler php55-cgi .php <Directory /usr/local/php55/cgi> Allow from all </Directory> <Directory /Library/WebServer/Documents/> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order Allow,Deny Allow from all </Directory> DirectoryIndex index.html index.php </VirtualHost>