Error with apache 2.4 and PHP 5.6.14-0+deb8u1 With fpm

apache-2.4fastcgiphp-fpmphp5

I have a Vagrant machine with:

  • Apache/2.4.10 (Debian)
  • PHP 5.6.14-0+deb8u1 and PHP-FPM.

In some case I get this error: 500 Internal Server Error.

And I have this in message in 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

And in the error.log file I have this message:

[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"

I have check my php.ini to update the options like this:

max_execution_time = 360
max_input_time = 180
memory_limit = 512M

This is my opcache file 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

and this is my 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>

I have read about the bug, but I don't find a clear way to solve it, or to know what happened with the app to give back this error.

Thanks.

Oskar

Best Answer

It seems your script is over max_execution_time. Maybe 360s

It could be very useful to get which function is consuming most of the execution time. You can use the slow log of php-fpm.

In your pool file (/etc/php5/fpm/pool.d/www.conf) look for:

  • 'slowlog', and add a log file like: '/var/log/php-fpm/www.log.slow'
  • 'request_slowlog_timeout', and add a time like: '10s'

Restart php-fpm, tailf this file and maybe you could trace your huge function.