-
Issue
I see errors in the PHP error log. What do they mean?
Resolution
PHP's error log is where you will find most of the problems caused by faults in PHP, whether those faults are caused by problems in the code itself, or by the code being unable to function properly due to other issues. Problems you might find include out-of-memory errors (OOM), undefined exceptions, and so on.
While you should ensure that the PHP error log is not overloaded with messages, it's also important to ensure that errors in the production environment are logged in case problems do arise. Failure to log these errors can cripple your ability to troubleshoot an issue. In most cases, disabling NOTICE
messages is enough to keep the messages down to critical notifications. To suppress these, place this code into your settings.php file
:
if (isset($_ENV["AH_PRODUCTION"]) && $_ENV["AH_PRODUCTION"] == 1)
{ error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT); }
See the PHP page on error_reporting()
for more examples. The method of suppression may change between PHP versions, so be sure to test if you update PHP.
Errors
Allowed memory size of 134217728 bytes exhausted (tried to allocate 19600 bytes) in
/mnt/www/html/sitename/docroot/modules/system/image.gd.inc on line 232
This is a memory exhaustion error and will cause a page load to fail. In this case, it's occurring in the Image module, but it can occur in a number of other modules. This error most often occurs when there's too much data or logic being processed for the standard amount of memory (128 MB) to handle. This is most commonly seen on administrative pages.
You have two possible approaches to this issue. You can troubleshoot the issue, or if you're an Acquia Cloud customer, you can increase your PHP memory limit in the UI. While it may be easier to just increase your PHP memory limit, this can have negative consequences. Higher memory levels can reduce the number of available PHP processes for handling uncached page requests. As a result of that, you may need to resize your server.
Acquia recommends that you attempt to isolate the root cause of the higher memory usage, especially if the need for memory begins to exceed 192 MB or 256 MB. Beyond this point, there are usually code or configuration changes that would be more beneficial and cost-effective. If possible, determine what code or configuration changes may have taken place that could cause a jump in memory usage. This may not be the sole culprit, as many pages behave normally until a certain point.
If you need help with troubleshooting, you may find the Help Center article on Memory consumption tracking tools to be useful.
Look for resource-intensive queries, modules, views, or functions. Determine if anything has changed in the site's code or configuration that might have caused these alerts to suddenly appear.
Common buffer sizes
For your reference, here's a table of common large buffer sizes that you may encounter in your site's PHP error logs:
Human Readable | Mathematical | Literal (PHP logging) |
---|---|---|
128 MB | 227 bytes | 134217728 bytes |
256 MB | 228 bytes | 268435456 bytes |
512 MB | 229 bytes | 536870912 bytes |
1 GB | 230 bytes | 1073741824 bytes |
4 GB | 232 bytes | 4294967296 bytes |