错误与Apache 2.4和PHP 5.6.14-0 + deb8u1与fpm

我有一个Vagrant机器:

  • Apache / 2.4.10(Debian)
  • PHP 5.6.14-0 + deb8u1和PHP-FPM。

在某些情况下,我得到这个错误:500内部服务器错误。

我在php5-fpm.log中有这个消息

[09-Dec-2015 20:01:24] WARNING: [pool www] child 608 exited on signal 11 (SIGSEGV) after 368.307577 seconds from start 

而在error.log文件中,我有这个消息:

 [Wed Dec 09 20:01:24.944748 2015] [fastcgi:error] [pid 535:tid 140236008924928] (104)Connection reset by peer: [client 192.168.33.1:57201] FastCGI: comm with server "/usr/lib/cgi-bin/php5-fcgi" aborted: read failed [Wed Dec 09 20:01:24.945014 2015] [fastcgi:error] [pid 535:tid 140236008924928] [client 192.168.33.1:57201] FastCGI: incomplete headers (0 bytes) received from server "/usr/lib/cgi-bin/php5-fcgi" 

我有检查我的php.ini更新这样的选项:

 max_execution_time = 360 max_input_time = 180 memory_limit = 512M 

这是我的opcache文件configuration:

 zend_extension=opcache.so opcache.enable=0 ; for now disabled opcache.enable_cli=1 opcache.memory_consumption=256 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=2000 ; Using "find /home -type f -print | grep php | wc -l" produced 226540 php files. opcache.max_wasted_percentage=5 opcache.use_cwd=1 opcache.validate_timestamps=0 opcache.revalidate_freq=60 opcache.fast_shutdown=1 

这是我的php5-fpm.conf

 <IfModule mod_fastcgi.c> AddHandler php5-fcgi .php Action php5-fcgi /php5-fcgi Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization -idle-timeout 3600 <Directory /usr/lib/cgi-bin> Require all granted </Directory> </IfModule> 

我已经阅读了这个错误,但是我没有find明确的方法来解决这个问题,或者知道应用程序发生了什么事情来回馈这个错误。

谢谢。

奥斯卡

看来你的脚本已经超过了max_execution_time。 也许360s

获取哪个函数耗费大部分执行时间可能非常有用。 你可以使用php-fpm的慢日志。

在您的池文件(/etc/php5/fpm/pool.d/www.conf)中寻找:

  • 'slowlog',并添加一个日志文件,如:'/var/log/php-fpm/www.log.slow'
  • 'request_slowlog_timeout',并添加一个像'10s'

重新启动php-fpm,尾随此文件,也许你可以跟踪你的巨大function。

从日志条目看起来像超时问题给我。

假设您可以提供一些PHP页面,并且报告的错误只有一页,我会尝试去除页面上的代码,直到find可能导致超时的块并从那里开始工作。 也许你有一个需要改进的数据库查询,或者你正在引用一个没有响应的外部Web服务。