How to Fix WordPress PHP limit issue

How to Fix WordPress PHP limit issue

In this article,we will be talking about How To Fix WordPress PHP limit issue.It is easily done  by increasing the memory size from within your WordPress. Keep reading about How To Fix WordPress php limit issue to learn more.

How To Fix WordPress PHP Limit Issue 

WordPress is a pretty stable platform to build websites but may give you some errors on occasions. By default, WordPress provides very little memory size( usually 32 or 64 MB) to its users. Depending on your hosting provider and server, this value may differ. 

wordpress environment page with wordpress memory limit

Since most sites nowadays require way more size than the default value, you may get a memory error like this.

Fatal error: Allowed memory size of xx bytes exhausted

How to increase the PHP Memory Limit of your WordPress?

There are two possible ways to increase the WordPress Memory limit of your website. 

  1. Define the new memory size all by yourself
  2. Let your hosting provider change it from the server

Let’s see how to increase the memory in both the ways. We would take a small example to show you how to do it. 

Changing the memory limit yourself

The very first step is to go into your wp-config.php file found in your WordPress’s root folder. You would need a file manager or an FTP Client to find this folder. 

Once you’re in, you need to copy and paste the following code into your wp-config.php file. 

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

This particular code line is to tell WordPress to increase the PHP memory limit to 512MB. 

Please Note: You must paste this code just before the line ‘That’s all, stop editing! Happy blogging.’ You can refer to the following sample image.

define memory limit in wp-config.php

After that, you must save the changes and upload the file back to your server to see if the error message is gone or not. 

If that doesn’t remove the error message, you may have to go to the PHP.ini file. If you have access to your PHP.ini file, you can go there and look for ‘memory_limit’ as shown below. 

changing the memory limit

Now, you need to replace the pre-defined size with the new one. So, for instance, if your line shows 256M, then try entering 512M:

memory_limit = 512M; Maximum amount of memory a script may consume (64MB)

However, if you don’t have access to your PHP.ini file, then you would have to do a workaround. You can try adding the following code to your .htaccess file. 

php_value memory_limit 512M

Have a look at the image below for your reference:

wordpress php value memory limit

Contacting your hosting provider

WordPress memory size can vary from server to server. Depending on your current hosting plan, you may be limited to a specific memory size(256MB, 512MB, 1GB, or more). 

That’s because each hosting plan would provide different sets of resources to customers. Should you feel the need to increase the size of your PHP Memory, then feel free to contact your hosting plan and change the plan. 

If you like this article ,please subscribe to our daily newsletter down below.

When having your website on WordPress you will need to choose a Good Looking Optimized theme , Speed optimization plugin and understand How to do Good SEO 

Leave a Reply