当我按照这里的教程启用suEXEC时,我能够让PHP在cgi模式下运行Apache,但是当我开始尝试使用suEXEC时,我得到一个403,并且在错误日志“client denied by服务器configuration“。 suEXEC日志是空的。 我怎样才能得到这个工作? 我的最终目标是用suexec来运行fastcgi,而这个错误已经使我无时无刻不在了。
httpd.conf的相关部分:
ScriptAlias /php5-cgi /usr/bin/php-cgi Action php5-cgi /php5-cgi AddHandler php5-cgi .php <Directory /usr/bin> Order allow,deny Allow from all </Directory> <VirtualHost *:80> ServerName skylords.com ServerAlias www.skylords.com en.skylords.com lt.skylords.com nl.skylords.com DocumentRoot /srv/http/htdocs SuexecUserGroup skylords skylords AddHandler php5-cgi .php ScriptAlias /php5-cgi /var/http/htdocs/cgi-bin/php-cgi ErrorDocument 404 /srv/http/htdocs ErrorLog /srv/http/logs/apache_error.log <Directory "/srv/http/htdocs"> AllowOverride All Order allow,deny Allow from all Options Indexes +FollowSymLinks +ExecCGI </Directory> </VirtualHost>
文件权限:
-rwxr-xr-x 1 skylords skylords 7207288 Apr 1 06:00 php-cgi drwxr-xr-x 2 skylords skylords 4096 Apr 1 06:13 cgi-bin drwxr-xr-x 17 skylords skylords 4096 Apr 1 06:19 htdocs drwxr-xr-x 11 skylords skylords 4096 Apr 1 06:13 http drwxr-xr-x 4 root root 4096 Apr 1 05:57 srv
你的cgi-bin目录和PHP fastcgi包装器脚本的权限是什么样的? 根据我的经验,suEXEC 403错误通常是因为脚本的所有者/组不匹配cgi-bin目录的所有者或其上面的目录。
编辑:好的。 不知道这里发生了什么…新的信息让我困惑了一下:-)你是否曾尝试在httpd.conf中设置LogLevel Debug ,并检查当你尝试在浏览器中加载PHP脚本时看到的错误日志?
ScriptAlias /php5-cgi /var/http/htdocs/cgi-bin/php-cgi应该是ScriptAlias /php5-cgi /srv/http/htdocs/cgi-bin/php-cgi 。 对不起,浪费你的时间。