Skip to content

Instantly share code, notes, and snippets.

@mkubenka
Created March 23, 2020 16:03
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mkubenka/cf977e9178a394850bd7b4d67efee3d0 to your computer and use it in GitHub Desktop.
Save mkubenka/cf977e9178a394850bd7b4d67efee3d0 to your computer and use it in GitHub Desktop.
How to enable CentOS PHP-FPM coredumps.

CentOS PHP-FPM coredumps

https://wiki.archlinux.org/index.php/Core_dump

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment