The PHP message Allowed memory size exhausted means a script tried to allocate more than its PHP memory limit. It can come from a large image, import, plugin conflict, excessive query results or a programming defect. The line reported is where allocation failed, which may be different from where the underlying problem began.
IN THIS ARTICLE
01 Identify the workload and limit
- Record the complete error, affected URL, time and action. Check whether normal pages work and whether a recent plugin, theme or deployment changed the behavior.
- Read the effective
memory_limitin the application's authenticated diagnostics. Compare it with account resource usage; total hosting RAM and a per-script PHP limit are separate controls. - For a large import or image, try a smaller batch or lower-resolution source. For a recent application change, reproduce the fault in staging and compare the previous version.
02 Apply a controlled correction
If the workload legitimately needs more memory and your plan permits it, use the active PHP configuration tool to make a modest increase. CloudLinux users can change the relevant Options value; a native cPanel or Plesk handler may use another settings page. Verify the result in the web runtime because command-line PHP can have different settings.
Do not use RLimitMem max as a PHP memory fix. It is an Apache process-resource directive, not the PHP memory_limit setting, and can be unsupported in your hosting context. Likewise, setting unlimited PHP memory does not remove account limits or repair runaway code.
How do I confirm a memory-exhaustion fix and prevent it from recurring?
- Repeat the failing action once, then check logs and resource usage. Confirm ordinary pages and concurrent customer activity still work.
- If usage continues growing, investigate the application component or query responsible. Use supported background processing, pagination or smaller batches rather than continually raising limits.
- Keep the previous configuration and backup available. Ask us support for a resource review with the error, timestamp, application version and test results. Do not include private database credentials or customer data.