Disabling Core Dumps

I recently found a (cPanel) server was generating over 100Gb of core dumps every time a bad PHP script died or Apache died. Writing these generally useless (who actually debugs these on a live web server) to disk is a pointless waste of disk I/O, especially in a VPS environment.

Here is two methods of disabling core dumps;cPanel/WHM

  1. Login to WHM
  2. Select ‘Tweak Settings’
  3. Search for ‘core’
  4. Turn ‘Generate core dumps’ off.

Linux

I usually do this on cPanel servers also, just to be double sure!

1. Disable core dumps for all users.
Edit /etc/security/limits.conf and check that * hard core 0 exists

2. Disable core dumps for setuid programs
[codesyntax lang=”bash”]
echo ‘fs.suid_dumpable = 0’ >> /etc/sysctl.conf
sysctl -p

3. Finally, set a soft limit to stop core dumps being created

[codesyntax lang=”bash”]
echo ‘ulimit -S -c 0 > /dev/null 2>&1’ >> /etc/profile

No reboot required.

 

Author: Kieran Barnes

Kieran is a PHP developer with 15 years commercial experience. Specialist in WordPress, CakePHP, CubeCart and all things PHP.

2 thoughts on “Disabling Core Dumps”

  1. Hi,
    what should I do – if my WHM already set to disable – but keep creating more and more CORE files?
    thanks,
    Assaf

Leave a Reply

Your email address will not be published. Required fields are marked *