How to Increase WordPress PHP Memory Limit via WP Config

There are instances where you need to increase the PHP memory limit of your WordPress site. However, you should only do this if you are experiencing problems like the following:

  1. You are experiencing a blank screen when navigating to some parts of your website, especially the admin page. This is also referred to as the “WordPress white screen of death“.
  2. You get stuck during the process of blog installation when using the All in One WP Migration plugin. The importing process hangs up and never comes to completion.
  3. You are getting a screen message like “Fatal error: Allowed memory size of 33554432…” and a similar fatal error message when viewing parts of your website.

When addressing the issues mentioned above, the first thing to do is to edit the wp-config.php file on your WordPress site. It is located in your WordPress site’s root folder, and you will need to use an FTP client or file manager in your web hosting control panel.

Just paste this code in the wp-config.php file just before the line that says “That’s all, stop editing! Happy blogging.

define( 'WP_MEMORY_LIMIT', '256M' );

This code tells WordPress to increase the PHP memory limit to 256MB.

copy and paste the code

Step by Step Guide for Beginner Webmasters

For complete beginners, here’s a step-by-step guide on how to edit the wp-config.php file:

  1. Login to Your cPanel. How? Check this.
  2. Find and click the “File Manage” Icon/Link.
    file manager link jupiter

    If you are still using the paper lantern theme, here’s what it looks like.
    file manager link paper lantern

  3. The File Manager page will open in a new tab.
    file manager page
  4. Click the “public_html” folder.
    click public html
  5. Click the wp-config.php file.
    wp config highlighted

    Don’t double click. Just one click only. The file should be highlighted as shown above screenshot.

  6. Now, right click over the wp-config.php file to bring out a menu box.
    right click wp config
  7. Click the “Edit” icon/link. See screenshot above.
  8. Click the “Edit” button.
    click edit pop up box
  9. A code editor page will open in a new tab. Here’s how it looks like:
    code editor page

    Want to see a larger version? Click here.

  10. Now, scroll down until the line that says, /* That’s all, stop editing! Happy publishing. */
    stop editing happy publishing line
  11. Copy and paste the below code before that line.
    define( 'WP_MEMORY_LIMIT', '256M' );

    copy and paste the code

  12. Finally, click the “Save Changes” button found at the topmost right of your screen.
    save changes button

That’s all, folks. Your WordPress memory limit is increased to 256M.

Try using a lower number, say 128M, or a higher one at 512M. Don’t forget to always include the letter “M“. Forgetting the letter M is a common mistake, so recheck your code.

You May Also Like