使用CGI在PHP 5.3上运行单个Apache Vhost,其他站点在Apache模块上使用PHP 5.2

我一直在试图设置我的开发服务器来使用PHP 5.3.14通过CGI为我的Apache虚拟主机提供服务。

我设置的Apache服务器是Apache 2.2.3,PHP 5.2.10作为Apache模块运行。 CentOS 5.5是操作系统。 其中一个网站使用的function只能在PHP 5.3中使用,而且我的网站需要5.2,所以我只想运行CGI上需要PHP 5.3的网站。

我已经跟随了几个教程,我已经安装了Apache / PHP 5.2并作为一个模块工作。 我也下载和编译PHP 5.3.14成功到我已经build立了php-5.3.14 / sapi / cgi / php-cgi可执行文件,并准备好去。 如果我运行它与脚本它能正常工作。 但是,在将我认为正确的指令添加到VirtualHost之后,该站点仍然不使用PHP 5.3,而是继续使用PHP 5.2(将版本设置为Apache模块)。

这是我的Vhostconfiguration:

<VirtualHost *:80> ServerName utfl.peapoddev.com ServerAlias elegal.utfl.peapoddev.com subsite.utfl.peapoddev.com library.utfl.peapoddev.com DocumentRoot /var/www/utfl/drupal DirectoryIndex index.html index.php SetEnv PHPRC /var/www/cgi-bin/php_5_3_14/ ScriptAlias /php-5-3-14/ /var/www/cgi-bin/php_5_3_14/ Action application/x-httpd-php-5-3-14 /php-5-3-14/php-cgi AddType application/x-httpd-php-5-3-14 .php .inc <Directory "/var/www/cgi-bin/php_5_3_14"> <Files "php-cgi"> Allow from all </Files> </Directory> <Directory "/var/www/utfl/drupal"> Options Indexes Includes FollowSymLinks AllowOverride None Order allow,deny Allow from all AllowOverride All </Directory> LogLevel Debug ErrorLog /var/www/utfl/logs/error_log CustomLog /var/www/utfl/logs/access_log combined 

让我知道如果你需要更多的信息。 我究竟做错了什么?

我一直在CentOS-5.9上使用下列configuration

 <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /vhosts/php53.example.net/ ServerName php53.example.net ScriptAlias /php-fastcgi/ /usr/local/php-5.3.26/bin/ AddHandler php-fastcgi .php AddType application/x-httpd-php .php Action php-fastcgi /php-fastcgi/php-cgi <Directory /vhosts/php53.example.net/> DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /vhosts/php52.example.net/ ServerName php52.example.net <Directory /vhosts/php52.example.net/> DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> 

php-5.3configuration了以下选项

 # # ./configure --prefix=/usr/local/php-5.3.26/ --enable-force-cgi-redirect --enable-pcntl --with-imap=shared --with-imap-ssl --enable-mbstring=shared --enable-mbregex --with-gd=shared --enable-bcmath=shared --enable-dba=shared --with-db4=/usr --with-xmlrpc=shared --with-ldap=shared --with-ldap-sasl --with-mysql=shared,/usr --with-mysqli=shared --enable-dom=shared --with-pgsql=shared --enable-wddx=shared --with-snmp=shared,/usr --enable-soap=shared --with-xsl=shared,/usr --enable-xmlreader=shared --enable-xmlwriter=shared --with-curl=shared,/usr --enable-fastcgi --enable-pdo=shared --with-pdo-odbc=shared,unixODBC,/usr --with-pdo-mysql=shared --with-pdo-pgsql=shared,/usr --with-pdo-sqlite=shared,/usr --with-pdo-dblib=shared,/usr --enable-json=shared --enable-zip=shared --without-readline --with-libedit --with-pspell=shared --enable-phar=shared --with-mcrypt=shared,/usr --with-tidy=shared,/usr --with-mssql=shared,/usr --enable-sysvmsg=shared --enable-sysvshm=shared --enable-sysvsem=shared --enable-posix=shared --with-unixODBC=shared,/usr --enable-fileinfo=shared --enable-intl=shared --with-icu-dir=/usr --with-enchant=shared,/usr --with-libdir=lib64 --with-kerberos --with-sqlite=shared