I would like to enable core dumps in my Apache web server.
Since I have PHP 5.5 and OPcache my Mediawiki site crashes with the following error:

child pid ... exit signal Segmentation fault (11)

So I would like to get more information through the core dump.

I created a directory: /tmp/apache-coredump owned by http:http (my apache user and group) and with the 777 rights.
I added to the httpd.conf file:

CoreDumpDirectory   "/tmp/apache-coredump"

But, now (with the CoreDumpDirectory instruction) my Apache server crashes on start-up:

sudo systemctl restart httpd

Job for httpd.service failed. 
See 'systemctl status httpd.service' and 'journalctl -xn' for details.

The journal give me the following info

apachectl[4149]: CoreDumpDirectory /tmp/apache-coredump does not exist

I checked, the directory exist 0_°

I changed the CoreDumpDirectory instruction in the httpd.conf file and it allows me to start my web server

CoreDumpDirectory /tmp

Without the CoreDumpDirectory instruction, there is no core dump generated in the ServerRoot (/etc/httpd) directory.
I'm on Archlinux 3.10.6-2 64-bits with Apache/2.2.25 Prefork

  • 1
    I can't be sure based on your description. But is it possible that you run apache in a root jail? that would be a reason why it can't find that directory. – replay Aug 19 '13 at 15:44
  • I don't think my web site is in a root jail (but I'm sure of nothing today). How to be sure I'm not and what to do if I am? I tested /tmp/apache-coredump as a file and it failed, but I tested CoreDumpDirectory /tmp and it allowed me to start Apache but without core dump. – Nicolas Aug 19 '13 at 15:57
  • You can be sure if you start your apache without the coredump parameter, so it starts successfully. then you check for the pid of one of the apache processes, then you execute ls -lha /proc/<pid>/root. the root entry of the <pid> folders in /proc is always pointing to the root for that process, so if the process is running in a jail root, this should point to somewhere else than /. – replay Aug 19 '13 at 16:06
  • Thanks for the tip. The ls -lha /proc/<pid>/root command returns /. So my web server doesn't run in a root jail :) CoreDumpDirectory /home/<user>/folder also works but doesn't allow me to generate the core dump file. – Nicolas Aug 19 '13 at 16:11
  • 1
    I had the same issue, and after trying various things I also ended up setting CoreDumpDirectory to just /tmp. But in any case, I guess the subdirectory would be deleted on a reboot, causing apache not to start. Perhaps it rejects subdirectories of /tmp for that reason... but it seems a bit far-fetched. – danmichaelo Apr 18 '16 at 14:01

Core dumps are generally disabled by default since they tend to waste disk space, you need to switch them on for your apache session.

$ ulimit -a
core file size          (blocks, -c) 0
$ ulimit -c unlimited
$ systemctl restart httpd

Also, do you have SELinux enabled? Output of ls -alZ /tmp/apache-coredump

  • ls -alZ /tmp/apache-coredump -> drwxrwxrwx 2 http http ? 40 19 août 21:40 . drwxrwxrwt 18 root root ? 520 19 août 21:40 .. But as /tmp/apache-coredump failed with the CoreDumpDirectory instruction I use /home/<user>/apache-coredump -> drwxrwxrwx 2 http http 4096 19 août 18:01 . – Nicolas Aug 19 '13 at 19:47
  • Thanks for the ulimit tip, I passed from 0 to unlimited but it still doesn't work. – Nicolas Aug 19 '13 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.