Enabling core dumps for PHP-FPM on CentOS 7 require several steps.
Set the rlimit_core
directive in /etc/php-fpm.d/pool.conf and /etc/php-fpm.conf to unlimited:
rlimit_core = unlimited
Set system parameters to generate core dumps:
# Send dumps via a pipe to the systemd-coredump
sysctl kernel.core_pattern='| /usr/lib/systemd/systemd-coredump %p %u %g %s %t %c %e'
# Enable core dumps for processes using setuid().
sysctl fs.suid_dumpable=2
# Do not add PID to core dump file.
sysctl kernel.core_uses_pid=0
Add to /etc/systemd/system.conf file:
DefaultLimitCORE=infinity
Reload systemd configuration:
systemctl daemon-reload
Restart PHP-FPM:
systemctl restart php-fpm
To confirm core dump was generated look for SIGSEGV - core dumped
in PHP-FPM error log:
[11-May-2015 15:34:03] WARNING: [pool www] child 2553 exited on signal 11 (SIGSEGV - core dumped) after 6943.521858 seconds from start
To interact with core dump we can use coredumpctl
utility:
coredumpctl list
coredumpctl info 123
coredumpctl gdb 123