PHP-FPM
¶
Error Log¶
The error log for the PHP-FPM
service is:
/var/log/php-fpm/error.log
Config File¶
The main configuration file for PHP-FPM
is:
`/etc/php-fpm.conf`
This file has an include to /etc/php-fpm.d/*.conf
:
~]# grep include /etc/php-fpm.conf
include=/etc/php-fpm.d/*.conf
Domain Error Log¶
The error log for your domain is located just outside of the document root:
/var/www/vhosts/domain.com/domain.com-phpfpm-error.log
This error log should be reviewed regularly as you may see PHP
errors in this file.
Domain Config File¶
The PHP-FPM
configuration pool for your domain is located in /etc/php-fpm.d/
/etc/php-fpm.d/domaincom.conf
Enable Core Dumps¶
PHP-FPM may log a SIGSEGV
error in the service’s error log file, example:
WARNING: [pool poolname] child 20196 exited on signal 11 (SIGSEGV) after 6.772815 seconds from start
Enabling core dumps can help to debug and find the cause of the SIGSEGV
.
If you need to enable core dumps you can run the below commands:
echo '/tmp/core-%e.%p' > /proc/sys/kernel/core_pattern
echo 0 > /proc/sys/kernel/core_uses_pid
ulimit -c unlimited
sysctl fs.suid_dumpable=2
Then set the rlimit_core
directive in the PHP-FPM configuration pool (/etc/php-fpm.d/domain.conf
) to unlimited:
rlimit_core = unlimited
Restart PHP-FPM and check the error log file for the SIGSEGV
, you should now see Ccore dumped
:
WARNING: [pool poolname] child 20196 exited on signal 11 (SIGSEGV - core dumped) after 6.772815 seconds from start
Core dumps should now be generated by PHP-FPM in the directory /tmp/
. You may need to install gdb
(yum install gdb)
so you can read the core dump file with the command gdb $program-path $coredump-path
. Example:
gdb /usr/sbin/php-fpm /tmp/coredump-php-fpm.1594
Once in the gdb
prompt the bt
command will show you the PHP backtrace
on the moment of the core dump. To exit gdb
, just type quit.