Have you ever tried uploading an image, activating a plugin, or saving a page in WordPress only to be greeted by a white screen saying: Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate ... bytes)?
This error means a PHP script exceeded the maximum RAM allocated to a single process on your web hosting account. Here is how to fix it in under 5 minutes.
Is Free Hosting Holding Your Website Back?
Free hosting is great for testing, but strict CPU, inode, and Entry Process limits can knock your site offline once Google starts indexing your pages. Run our 60-second check to see what your site actually needs:
Method 1: Increase `WP_MEMORY_LIMIT` in `wp-config.php` (Fastest Fix)
By default, WordPress sets its own memory limit to just 40MB on single sites—even if your hosting plan allows 256MB or 512MB! You can generate the exact configuration snippet using our Free WordPress wp-config.php & Salt Generator, or add these two lines manually above /* That's all, stop editing! */ in wp-config.php:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );Method 2: Update `memory_limit` in cPanel MultiPHP INI Editor
If editing wp-config.php doesn’t resolve the error, your server’s PHP configuration is capping your account lower than 256M:
- Log into cPanel and open MultiPHP INI Editor (under the Software section).
- Select your domain from the dropdown menu.
- Locate the
memory_limitrow and change it from64Mor128Mto256M(or512M), then click Apply.
Method 3: When Free Hosting Hard-Caps Your PHP Memory
Many free hosting providers strictly lock memory_limit at 64MB or 128MB at the hypervisor level and ignore custom php.ini or .htaccess overrides. If you run WooCommerce, Elementor, or SEO suites, use our WordPress Hosting Requirement Calculator to see how much RAM your plugin stack truly requires.
Frequently Asked Questions (FAQ)
What causes the Allowed memory size exhausted fatal error in WordPress?
WordPress defaults to a 40MB PHP memory limit for single sites, which is too small for modern themes, WooCommerce, or Elementor. When a script tries to allocate more RAM than PHP allows, it crashes with a fatal memory error.
Where do I put define(‘WP_MEMORY_LIMIT’, ‘256M’) in wp-config.php?
Place the line inside your wp-config.php file right above the comment that says /* That’s all, stop editing! Happy publishing. */.
What if changing wp-config.php does not fix the memory exhausted error?
If your free or shared hosting provider enforces a hard ceiling (such as 64MB or 128MB) in the master php.ini configuration, wp-config.php cannot override it—you must either raise memory_limit in cPanel MultiPHP INI Editor or upgrade your hosting plan.