:::: MENU ::::

Generating core dumps for PHP-FPM

  • Apr 16 / 2015
  • 0

Generating core dumps for PHP-FPM

When you are getting some errors from PHP-FPM like “signal 11 (core dumped)” in your logs, you can need to generate some core dumps to understand what’s happening.

Install packages

You first need to install some packages to allow you generating dumps:

System core updates

You will then need to update some sysctl parameters. Those commands will request root access to be executed.
Obviously, you can change the directory in which one you want to put the core dumps depending on your configuration (here /opt/core/ is used):

You can use several patterns for naming your core dumps files:

Update PHP-FPM config

Once system configuration performed, you will need to update php-fpm configuration as well.
Edit file /etc/php5/fpm/php-fpm.conf (or specific pool configuration file under pool.d directory) and uncomment following line:

Once done, restart php5-fpm service:

Your core dumps will now be created in the folder you indicated at the beginning as soon as a new core dump will be generated.

Check your core dumps

Check your PHP-FPM logs, and if you see something like:

Go to the folder you chose for storing core dumps and you will see your core dump files:

Analyze a core dump

Once core dump generated, you will need to analyze this file to see why this core dump has been generated.
For that, you will need to use a standard tool called gdb.

Use this command line with the new file just generated to launch a debug shell and start analysis:

Once the shell is launched you can use different commands to analyze output like:

  • backtrace: it will display the simple backtrace of core dump
  • backtrace full: will display the full detailed backtrace

You will so get the backtrace of code that generated this core dump and be able to debug the application easily!

WARNING: Be careful to those core dumps which can be quite big and take lots of disk space very quickly if lots of core dumps are generated.

Comments are closed.

Question ? Contact