我正在运行主题中提到的软件版本。Apache 是从标准 centos repo 安装的,fastcgi 是从http://centos.karan.org/kbsingh-CentOS-Extras.repo并且 PHp 被手动编译并安装到 /usr/local/php5-fastcgi。
当我尝试访问以下 URL 时,我总是收到 5xx 服务器错误http://vantagefx.com/affiliate/merchants/,(顺便说一下我没有使用 suexec)。
虚拟主机
<VirtualHost x.x.x:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<IfModule mod_fcgid.c>
<Directory /var/www/html/php530-files/>
Options +ExecCGI
AllowOverride All
AddHandler fcgid-script .php
FCGIWrapper /var/www/php-fcgi-scripts/php-fcgi-starter .php
Order allow,deny
Allow from all
</Directory>
</IfModule>
/var/www/php-fcgi-scripts/php-fcgi-starter
#!/bin/sh
export PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_CHILDREN=8
exec /usr/local/php5-fcgi/bin/php -c /etc/php.ini
错误日志
[Wed Sep 08 02:39:25 2010] [notice] mod_fcgid: process /var/www/html/php530-files/scripts/imp.php(2319) exit(communication error), terminated by calling exit(), r5
[Wed Sep 08 02:39:30 2010] [notice] mod_fcgid: call /var/www/html/php530-files/scripts/imp.php with wrapper /var/www/php-fcgi-scripts/php-fcgi-starter
[Wed Sep 08 02:39:31 2010] [notice] mod_fcgid: call /var/www/html/php530-files/scripts/imp.php with wrapper /var/www/php-fcgi-scripts/php-fcgi-starter
[Wed Sep 08 02:39:32 2010] [notice] mod_fcgid: call /var/www/html/php530-files/scripts/imp.php with wrapper /var/www/php-fcgi-scripts/php-fcgi-starter
[Wed Sep 08 02:39:33 2010] [notice] mod_fcgid: call /var/www/html/php530-files/scripts/imp.php with wrapper /var/www/php-fcgi-scripts/php-fcgi-starter
[Wed Sep 08 02:39:33 2010] [notice] mod_fcgid: process /var/www/html/php530-files/scripts/imp.php(2340) exit(communication error), terminated by calling exit(), r5
[Wed Sep 08 02:39:33 2010] [notice] mod_fcgid: process /var/www/html/php530-files/scripts/imp.php(2335) exit(communication error), terminated by calling exit(), r5
[Wed Sep 08 02:39:33 2010] [notice] mod_fcgid: process /var/www/html/php530-files/scripts/imp.php(2334) exit(communication error), terminated by calling exit(), r5
[Wed Sep 08 02:39:37 2010] [notice] mod_fcgid: process /var/www/html/php530-files/scripts/imp.php(2341) exit(communication error), terminated by calling exit(), r5
[Wed Sep 08 02:39:42 2010] [notice] mod_fcgid: call /var/www/html/php530-files/scripts/imp.php with wrapper /var/www/php-fcgi-scripts/php-fcgi-starter
[Wed Sep 08 02:39:43 2010] [notice] mod_fcgid: call /var/www/html/php530-files/scripts/imp.php with wrapper /var/www/php-fcgi-scripts/php-fcgi-starter
[Wed Sep 08 02:39:44 2010] [notice] mod_fcgid: call /var/www/html/php530-files/scripts/imp.php with wrapper /var/www/php-fcgi-scripts/php-fcgi-starter
[Wed Sep 08 02:39:45 2010] [notice] mod_fcgid: call /var/www/html/php530-files/scripts/imp.php with wrapper /var/www/php-fcgi-scripts/php-fcgi-starter
[Wed Sep 08 02:39:45 2010] [notice] mod_fcgid: process /var/www/html/php530-files/scripts/imp.php(2364) exit(communication error), terminated by calling exit(), r5
[Wed Sep 08 02:39:45 2010] [notice] mod_fcgid: process /var/www/html/php530-files/scripts/imp.php(2359) exit(communication error), terminated by calling exit(), r5
和:
[Wed Sep 08 09:49:05 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:06 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:07 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:16 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:17 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:18 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:19 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:28 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:29 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:30 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:31 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:35 2010] [warn] mod_fcgid: can't apply process slot for /var/www/html/affiliate/phpinfo.php
[Wed Sep 08 09:49:40 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:41 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:42 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:43 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:52 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:53 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:54 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:49:55 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Sep 08 09:50:05 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
如果我手动执行代码
/usr/local/php5-fcgi/bin/php /var/www/html/php530-files/scripts/imp.php
它执行得很好,没有错误,没有警告,没有通知。
[编辑]
PHP 进程
ps aux | grep php
apache 22494 1.5 0.0 0 0 ? Z 08:16 0:00 [php] <defunct>
root 22500 0.0 0.0 61168 728 pts/0 S+ 08:16 0:00 grep php
我还在 php530-files 目录中创建了一个 phpinfo.php 并尝试访问它,但仍然没有成功,503 Service Unavailable 并且日志是:
[Wed Sep 08 08:27:45 2010] [notice] mod_fcgid: call /var/www/html/php530-files/phpinfo.php with wrapper /var/www/php-fcgi-scripts/php-fcgi-starter
[Wed Sep 08 08:27:46 2010] [notice] mod_fcgid: call /var/www/html/php530-files/phpinfo.php with wrapper /var/www/php-fcgi-scripts/php-fcgi-starter
瞧,这个过程并没有由于任何通信错误或类似错误而终止,但我仍然收到 5xx 错误。
权限
[root@www php530-files]# ls -l
total 35604
drwxrwxr-x 3 apache vfx_affil 4096 Sep 8 03:41 accounts
drwxrwxr-x 4 apache vfx_affil 4096 Sep 8 03:42 affiliates
drwxrwxr-x 2 apache vfx_affil 4096 Sep 8 03:41 api
-rw-rw-r-- 1 apache vfx_affil 247 Sep 8 03:41 CHANGELOG.txt
drwxrwxr-x 11 apache vfx_affil 4096 Sep 8 03:41 include
-rw-rw-r-- 1 apache vfx_affil 2203 Sep 8 03:41 index.html
drwxrwxr-x 9 apache vfx_affil 4096 Sep 8 03:41 install
-rw-rw-r-- 1 apache vfx_affil 185 Sep 8 03:42 INSTALL.txt
-rw-rw-r-- 1 apache vfx_affil 7643 Sep 8 03:41 LICENSE.txt
drwxrwxr-x 3 apache vfx_affil 4096 Sep 8 03:41 merchants
-rw-rw-r-- 1 apache vfx_affil 36340881 Sep 8 03:41 pap_4.5.19.2.zip
-rw-r--r-- 1 apache vfx_affil 20 Sep 8 08:23 phpinfo.php
drwxrwxr-x 52 apache vfx_affil 4096 Sep 8 03:42 plugins
-rw-rw-r-- 1 apache vfx_affil 1008 Sep 8 03:41 README.txt
drwxrwxr-x 2 apache vfx_affil 4096 Sep 8 03:41 samples_tests
drwxrwxr-x 3 apache vfx_affil 4096 Sep 8 03:50 scripts
-rw-r--r-- 1 apache vfx_affil 31 Sep 8 08:27 test.php
-rw-rw-r-- 1 apache vfx_affil 371 Sep 8 03:41 UPDATE.txt
[root@www affiliate]# ls -l /var/www/php-fcgi-scripts/
total 4
-rwxrwxr-x 1 apache vfx_affil 203 Sep 8 03:39 php-fcgi-starter
答案1
是否/var/www/php-fcgi-scripts/php-fcgi-starter
可执行?它和它所在的目录是否归 Web 服务器用户所有?
答案2
找到了!就我而言,我在 /var/www/php-fcgi-scripts/php-fcgi-starter 中使用了错误的 php 二进制文件,它应该是 php-cgi。
与以下产品配合使用效果极佳:
#!/bin/sh
PHP_CGI=/usr/local/php5-fcgi/bin/php-cgi
PHP_INI=/etc/php-fastcgi.ini
export PHP_FCGI_TIMEOUT=1200
export PHP_FCGI_CHILDREN=10
export PHP_FCGI_MAX_REQUESTS=1000
exec $PHP_CGI -c $PHP_INI