PHP "Allowed memory size exhausted" error
On this page
PHP gives each request a maximum amount of memory (memory_limit). A page, import or plugin that needs more stops with this error. You can raise the limit yourself on the PHP page.
Symptoms
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)on the Errors page or in~/logs/php-errors.log. (134217728 bytes = 128 MB.)- A 500 error, a WordPress "critical error" or a blank page, often only on big pages, imports or the admin area.
Causes
- The PHP memory limit is too low for the application (shops, page builders and imports need more).
- A plugin or script uses far too much memory — a loop, or loading a huge file or table at once.
- The account's own memory limit is reached (set by your plan), even though PHP's limit is higher.
Fix
1. Raise the PHP memory limit
- Open PHP (section Advanced).
- Under PHP settings, enter a value in Memory limit (MB), for example
256or512(allowed: 32 to 2048). Or click a Ready-made button: WordPress (256 MB) or WooCommerce / large shop (512 MB). - Click Save settings.
The setting applies to all websites of your account from their next request.
php_value memory_limit lines in a site's .htaccess. A WordPress setting such as WP_MEMORY_LIMIT cannot go above the PHP limit.2. A script uses too much
If the error stays at any limit (the "tried to allocate" amount is small and the allowed size is already large), the code is the problem. The error line names the file: update or replace that plugin, or split the import into smaller parts.
3. The account's memory limit
Your plan also limits the memory of all your account's processes together. When it is reached, the biggest process is stopped — visitors then get an error even with a high PHP limit.
- Open Resource Usage (section Advanced).
- Under Server resources, check Memory and the Limits reached column ("3× memory").
Raising Memory limit (MB) above your plan's memory does not help. Lower it again, find the heavy page or cron job, or ask your host for a bigger plan.
Still not working?
- Check that you saved the setting for the right account: the PHP page applies to every website of the account you are signed in to.
- If your host has turned on the AI assistant, click Explain with AI on the Errors page.
- Contact your host through Support with the error line.
Thank you — this helps us improve the article.
Still stuck?
Ask the AI about your exact situation — it answers from this knowledge base — or contact us.
Related articles
- PHP "Maximum execution time exceeded" error
Fix "Fatal error: Maximum execution time of 30 seconds exceeded": raise max_execution_time in the control panel, or move long jobs to a cron job.
- Upload fails: file exceeds upload_max_filesize
Fix "The uploaded file exceeds the upload_max_filesize directive in php.ini" and other upload size errors by raising the limits in the control panel.
- Website shows 503 Service Unavailable (or 502, 504)
Why a site answers "503 Service Unavailable" (or 502/504) here: account limits reached, an application stopped, PHP not starting. How to check and fix it.