错误 500 / 503

错误 500 / 503

我收到错误 500 / 503。我的理论是,php5-fpm 每秒都会被杀死并重新生成,因为 php5-fpm.log 中有这样的消息

[27-Jan-2015 08:21:34] NOTICE: fpm is running, pid 30045
[27-Jan-2015 08:21:34] NOTICE: ready to handle connections
[27-Jan-2015 08:21:44] NOTICE: Finishing ...
[27-Jan-2015 08:21:44] NOTICE: exiting, bye-bye!
[27-Jan-2015 08:21:44] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful

[27-Jan-2015 08:21:44] NOTICE: fpm is running, pid 30066
[27-Jan-2015 08:21:44] NOTICE: ready to handle connections
[27-Jan-2015 08:21:54] NOTICE: Finishing ...
[27-Jan-2015 08:21:54] NOTICE: exiting, bye-bye!
[27-Jan-2015 08:21:55] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful

我得出结论,这是正常现象。我的错误 500/503 一定是由其他原因引起的。当我多次按 F5 时,错误就会发生。有什么想法吗?

PHP

PHP 5.4.36-0+deb7u3 (cli) (built: Jan  9 2015 08:07:06)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

Lighttpd

lighttpd/1.4.31 (ssl) - a light and fast webserver
Build-Date: Mar 13 2014 02:17:09

閣下網站

[www]
;prefix = /path/to/pools/$pool
user = www-data
group = www-data
listen = /var/run/php5-fpm.sock
;listen = 127.0.0.1:9000
;listen.backlog = 128
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
;listen.allowed_clients = 127.0.0.1
; process.priority = -19
pm = static
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.process_idle_timeout = 10s;
;pm.max_requests = 500
;pm.status_path = /status
;ping.path = /ping
;ping.response = pong
;access.log = log/$pool.access.log
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
;slowlog = log/$pool.log.slow
;request_slowlog_timeout = 0
;request_terminate_timeout = 0
;rlimit_files = 1024
;rlimit_core = 0
;chroot =
chdir = /

php5-fpm.log

[27-Jan-2015 08:21:55] NOTICE: fpm is running, pid 30087
[27-Jan-2015 08:21:55] NOTICE: ready to handle connections
[27-Jan-2015 08:22:05] NOTICE: Finishing ...
[27-Jan-2015 08:22:05] NOTICE: exiting, bye-bye!
[27-Jan-2015 08:22:05] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful

[27-Jan-2015 08:22:05] NOTICE: fpm is running, pid 30108
[27-Jan-2015 08:22:05] NOTICE: ready to handle connections
[27-Jan-2015 08:22:15] NOTICE: Finishing ...
[27-Jan-2015 08:22:15] NOTICE: exiting, bye-bye!
[27-Jan-2015 08:22:15] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful

Lighttps 错误日志

2015-01-27 08:36:22: (mod_fastcgi.c.2543) unexpected end-of-file (perhaps the fastcgi process died): pid: 0 socket: unix:/var/run/php5-fpm.sock

2015-01-27 08:36:22: (mod_fastcgi.c.3329) response not received, request sent: 1184 on socket: unix:/var/run/php5-fpm.sock for /index.php?, closing connection

答案1

您的 PHP 脚本很可能有错误。要了解更多信息,请使用 php-fpm.conf 中的 php 错误日志指令。

php_admin_flag[log_errors]=On
php_admin_value[error_reporting]=E_ALL
php_admin_value[error_log]=/var/log/php-errors.log

相关内容