How to get a core dump from apache when segfaulting
Solution 1:
My answer is this:
Set up the directive as follow
CoreDumpDirectory /tmp/mycoredump
Create the directory:
mkdir -p /tmp/mycoredump
Assign ownership to the directory www-data or httpd
chown -R www-data:www-data /tmp/mycoredump
Set permissions to:
chmod 777 /tmp/mycoredump
Restart Apache:
service apache2 restart
Solution 2:
Note that if you have PrivateTmp=true
set in your /usr/lib/systemd/system/apache2.service
(or whatever it's called on your system), meaning Apache actually looks for /tmp
inside something like /tmp/systemd-private-c27fc5b152d546159d675e170641529b-apache2.service-IcEt0m/
, Apache won't be able to write to that dir and you won't get cores dumped at all (due to the systemd
tmp directory having 700 root-only perms).
The solution is to either set PrivateTmp=false
or modify the permission of the systemd tmp directory after the server starts.
I wasted hours on this to only just now finally realize what the problem was.