{"id":350,"date":"2010-07-08T06:20:24","date_gmt":"2010-07-08T12:20:25","guid":{"rendered":"http:\/\/blog.supportpro.com\/?p=350"},"modified":"2026-02-23T03:40:08","modified_gmt":"2026-02-23T09:40:08","slug":"how-to-stop-core-file-generation","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/how-to-stop-core-file-generation\/","title":{"rendered":"How to Disable Apache Core Dumps and Stop Core Files from Filling Disk Space"},"content":{"rendered":"\n<p>A <strong>core file<\/strong> (core dump) is a memory snapshot of a running process at the time it crashes or is forcefully terminated.<\/p>\n\n\n\n<p>When a PHP process is killed (due to memory limits, segmentation faults, or fatal errors), <strong>Apache HTTP Server<\/strong> may generate core dump files under the user\u2019s account.<\/p>\n\n\n\n<p>These files:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Can be very large<\/li>\n\n\n\n<li>Accumulate quickly<\/li>\n\n\n\n<li>Consume significant disk space<\/li>\n\n\n\n<li>Are rarely needed on production servers<\/li>\n<\/ul>\n\n\n\n<p>In most shared or VPS hosting environments, it is safe to disable core dumps unless you are actively debugging crashes.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Why Core Files Are Created<\/h1>\n\n\n\n<p>Core dumps are typically generated when:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A PHP process crashes<\/li>\n\n\n\n<li>Memory limits are exceeded<\/li>\n\n\n\n<li>A segmentation fault occurs<\/li>\n\n\n\n<li>A module misbehaves<\/li>\n<\/ul>\n\n\n\n<p>On servers running <strong>PHP<\/strong> with Apache, these dumps may appear in:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/home\/username\/<\/code><\/pre>\n\n\n\n<p>or sometimes in:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/var\/www\/<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">Are Core Files Safe to Delete?<\/h1>\n\n\n\n<p>Yes.<\/p>\n\n\n\n<p>If you are not debugging crashes, core files:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Are not required for normal operation<\/li>\n\n\n\n<li>Can be safely deleted<\/li>\n\n\n\n<li>Will not affect Apache or PHP functionality<\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\">How to Disable Core Dumps in Apache<\/h1>\n\n\n\n<p>To prevent Apache from generating core files, you can modify the startup configuration to disable core dumps using <code>ulimit<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Edit the Apache Startup File<\/h2>\n\n\n\n<p>Open the Apache init script:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vi \/etc\/init.d\/httpd<\/code><\/pre>\n\n\n\n<p>(Depending on your system, this may also be located at:)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/etc\/systemd\/system\/httpd.service<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/usr\/lib\/systemd\/system\/httpd.service<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Locate Existing <code>ulimit<\/code> Directives<\/h2>\n\n\n\n<p>Search for lines such as:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ulimit -n 1024<br>ulimit -n 4096<br>ulimit -n 8192<br>ulimit -n 16384<\/code><\/pre>\n\n\n\n<p>These lines define the maximum number of open file descriptors.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Add Core Dump Limit Directive<\/h2>\n\n\n\n<p>Below the existing <code>ulimit -n<\/code> line, add:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ulimit -c 0<\/code><\/pre>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ulimit -n 16384<br>ulimit -c 0<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">What This Does<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>-c<\/code> controls the core file size limit<\/li>\n\n\n\n<li>Setting it to <code>0<\/code> disables core dump generation<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Save and Exit<\/h2>\n\n\n\n<p>In <code>vi<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ESC \u2192 :wq \u2192 Enter<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Restart Apache<\/h2>\n\n\n\n<p>Restart the service for changes to take effect:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>service httpd restart<\/code><\/pre>\n\n\n\n<p>or on systemd systems:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart httpd<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">Important Notes for Modern Systems (Systemd-Based Servers)<\/h1>\n\n\n\n<p>On newer Linux distributions (CentOS 7+, AlmaLinux, Rocky Linux), Apache runs under <strong>systemd<\/strong>, and modifying <code>\/etc\/init.d\/httpd<\/code> may not work.<\/p>\n\n\n\n<p>In that case, use:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl edit httpd<\/code><\/pre>\n\n\n\n<p>Add:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;Service]<br>LimitCORE=0<\/code><\/pre>\n\n\n\n<p>Then reload and restart:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl daemon-reload<br>systemctl restart httpd<\/code><\/pre>\n\n\n\n<p>This is the recommended method on modern systems.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">How to Remove Existing Core Files<\/h1>\n\n\n\n<p>To find large core files:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>find \/home -type f -name \"core*\" -size +50M<\/code><\/pre>\n\n\n\n<p>To delete them:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rm -f \/home\/username\/core.*<\/code><\/pre>\n\n\n\n<p>Always verify before mass deletion.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">When You Should NOT Disable Core Dumps<\/h1>\n\n\n\n<p>Keep core dumps enabled if:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You are debugging segmentation faults<\/li>\n\n\n\n<li>A developer is investigating crashes<\/li>\n\n\n\n<li>You are performing advanced diagnostics<\/li>\n<\/ul>\n\n\n\n<p>Core dumps are useful for deep debugging using tools like <code>gdb<\/code>.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Conclusion<\/h1>\n\n\n\n<p>Core dump files created by Apache and PHP can consume large amounts of disk space and are usually unnecessary in production environments.<\/p>\n\n\n\n<p>By setting:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ulimit -c 0<\/pre>\n\n\n\n<p>you can safely disable core file generation and prevent disk space issues.<\/p>\n\n\n\n<p>On modern Linux systems, using <code>LimitCORE=0<\/code> via systemd is the preferred approach.<\/p>\n\n\n\n<p>If you require help, <a href=\"https:\/\/www.supportpro.com\/requestquote.php\">contact SupportPRO Server Admin<\/a><\/p>\n\n\n\n<p class=\"has-text-align-center\"><span id=\"hs-cta-wrapper-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-wrapper\"><span id=\"hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-node hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\"><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b\"><img decoding=\"async\" id=\"hs-cta-img-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-img\" style=\"border-width: 0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b.png\" alt=\"Server not running properly? Get A FREE Server Checkup By Expert Server Admins - $125 Value\"><\/a><\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A core file (core dump) is a memory snapshot of a running process at the time it crashes or is forcefully terminated. When a PHP process is killed (due to&hellip;<\/p>\n","protected":false},"author":4,"featured_media":15616,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-350","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-miscellaneous"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=350"}],"version-history":[{"count":2,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/350\/revisions"}],"predecessor-version":[{"id":15617,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/350\/revisions\/15617"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media\/15616"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}