您不必刪除處理程序,類型或將PHP引擎關閉。
在你<VirtualHost ...>
添加如下幾行:
<FilesMatch \.php$>
SetHandler None
</FilesMatch>
這樣,您將移除/etc/httpd/conf.d/php.conf(或php5.conf添加了處理程序,或其他)它說:
#
# Cause the PHP interpreter to handle files with a .php extension.
#
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
編輯:這是更好也禁用根據suphp.conf PHP的引擎文件:
# Disable php when suphp is used, to avoid having both.
<IfModule mod_php5.c>
php_admin_flag engine off
</IfModule>
您的網站現在將在suPHP下運行。 (另外,如果你已經在/ usr /共享/ phpMyAdmin的phpMyAdmin安裝,它會在mod_php的工作,這是偉大的。)
最後,來看看我的VirtualHosts配置之一:
<VirtualHost 1.2.3.4:80>
ServerName site.com
ServerAlias www.site.com
ServerAdmin [email protected]
DocumentRoot /home/site/public_html
Options -Indexes
suPHP_Engine on
suPHP_UserGroup site site
suPHP_ConfigPath "/home/site/public_html"
suPHP_AddHandler x-httpd-php
AddHandler x-httpd-php .php .php3 .php4 .php5
# Remove the handler added by php.conf
<FilesMatch \.php$>
SetHandler None
</FilesMatch>
# Disable php when suphp is used, to avoid having both.
<IfModule mod_php5.c>
php_admin_flag engine off
</IfModule>
ErrorLog "|cronolog /home/site/.logs/error_%Y_%m.log"
CustomLog "|cronolog /home/site/.logs/access_%Y_%m.log" combined
</VirtualHost>
最後請注意:
如果你的phpMyAdmin的位於在/ usr /共享/ phpMyAdmin的是不工作,你的httpd.conf結束或在您的主虛擬主機添加以下行:
<Directory /usr/share/phpMyAdmin>
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
<IfModule mod_php5.c>
php_admin_flag engine on
</IfModule>
</Directory>
例如:
<VirtualHost 1.2.3.4:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html
Options -Indexes
<Directory /usr/share/phpMyAdmin>
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
<IfModule mod_php5.c>
php_admin_flag engine on
</IfModule>
</Directory>
ErrorLog "|cronolog /var/www/.logs/error_%Y_%m.log"
CustomLog "|cronolog /var/www/.logs/access_%Y_%m.log" combined
</VirtualHost>
最有可能Serverfault – Dave