How to increase PHP memory limit in WordPress?

One of the most common WordPress errors is the WordPress php memory limit error. When you exceed the PHP memory limit, your site will display an error message like “Fatal error: Allowed memory size NNNN bytes exhausted”.

Luckily, there’s a simple way to fix this and it won’t take much time at all. This article will show you how to do that so your website will stay up and running without any php memory limit issues!

What is WordPress PHP memory limit error?

WordPress PHP memory limit error is a message that appears when WordPress tries to execute the PHP statement that causes the error. The most common cause is not setting up enough memory to execute the PHP.

To check this, open the hosting account settings page, and see the memory limit for your account. If it’s not enough, contact your hosting provider for help. You can also increase the PHP memory limit on your own. Here is the short user guide to increasing the WordPress PHP memory limit for your website.

How to increase PHP memory limit in WordPress?

Increasing the memory limit for PHP is a good first step to help WordPress run efficiently. This usually involves editing the wp-config file. It can be found in your WordPress site’s root folder and you can either use an FTP client or file manager to edit the wp-config.php file.

Once you open the wp-config.php file, please find the below code and paste it just before the line where it says “/* That’s all, stop editing! Happy publishing. */”

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

This code will increase the PHP memory limit to 512 MB. Now, you’ll need to save the changes you’ve made and upload the wp-config.php file to its correct location. You can set your own limit. Here we set it to 512MB as an example. You can also change it to 128MB or 256 MB or any other valid input value.

Now you can check your website settings and you won’t see the memory limit warning anymore.

If you have any issues, please leave a comment below.

If you are looking for the answer to other how-to questions, please visit our website for more how-to-related content.


  1. Have you ever considered about adding a little bit more than just your articles? I mean, what you say is important and all. Nevertheless think of if you added some great photos or video clips to give your posts more, “pop”! Your content is excellent but with images and videos, this website could certainly be one of the best in its niche. Very good blog!


Please enter your comment!
Please enter your name here

Stay in Touch

Follow Us for more content that will refine your skillset.


Related Articles