How to resolve large PHP error logs in WordPress

Excessive PHP error logging can cause major issues for WordPress websites. Left unchecked, error logs can balloon to dozens of gigabytes, quickly filling server storage and even causing downtime. We recently handled a case where PHP logs had grown to more than 42 GB in under two months, threatening site stability. Here’s how we diagnosed and resolved the problem.

Issue Background

The site was generating a massive number of PHP error log entries starting July 18th. By early September, the logs had reached 42 GB, leaving the server 87% full. Simply deleting the logs was not a long-term fix, since they would immediately start growing again.

Diagnosis

Upon inspection, we found:

  • The bulk of log entries were PHP notices and warnings, not fatal errors.
  • Many came from common plugins, such as login customizers, nested pages, SMTP tools, scheduling tools, and security plugins.
  • These messages were not site-breaking, but were triggered when plugins executed code before WordPress’s init hook — a behavior WordPress 6.7 has become stricter about logging.
  • The sheer volume of messages created “noise” that overwhelmed the error log file.

Resolution Steps

Our team took a multi-step approach:

  1. Disable debug logging in wp-config.php: WordPress’s debug logging was turned off to prevent excessive notices from being written to the error log.
  2. Truncate oversized logs: The existing PHP-FPM log was trimmed from 39 GB down to just 63 MB, retaining only the most recent entries for reference.
  3. Filter log noise: We implemented a script to filter and suppress repetitive “doing it wrong” notices, reducing unnecessary entries.
  4. Monitor log growth: After filtering, the log size stabilized at ~3 MB. Subsequent checks showed small amounts of growth from plugin warnings, but no runaway log size increases.
  5. Introduce log rotation and purging: Since some level of logging is useful for identifying real issues, we recommended monthly log purges or log rotation to keep file sizes manageable while maintaining visibility.

Final Outcome

The PHP error logs were reduced from 42 GB to just a few megabytes, freeing up disk space and preventing downtime. The client now has a maintenance plan in place to manage logs proactively.

By combining debugging adjustments, plugin review, and log management strategies, we ensured ongoing site stability without losing important visibility into future PHP errors.


If your WordPress site is struggling with oversized PHP error logs or plugin-related warnings, contact Freshy for expert support in keeping your site stable and optimized.