- What is WordPress Memory limit Error?
- Why does WordPress need more memory to begin with?
- How to Increase Memory Limit in WordPress?
- Increase memory limit from your wp-config.php file
- Increase memory limit from PHP.ini file
- Increase memory limit from .htaccess file
- How to Check the WordPress Memory Limit?
- Conclusion on WordPress memory limit
WordPress has become one the most popular blogging platforms around the world. It’s become popular over the years, and it continues to grow. WordPress powers millions of sites and blogs, and it’s also a great solution for building custom web pages. But sometimes, it become headache to increase memory limit in wordpress.
However, despite its ease of use and powerful features, WP can sometimes cause headaches for users. For example, if you try to upload too much data at once, you might get a 500 error message. If you don’t know how to fix this issue, you might be stuck with a broken site.
The one of the reason for 500 is low memory limit. today we will discuss about increase wordpress memory and how to solve this.
What is WordPress Memory limit Error?
WordPress is written in PHP , which is a server-side programming language. Every wordpress website needs a hosting server for it to function properly. Web servers are just like any other computer. They also need memory to efficiently run multiple applications at the same time. Server administrators allocate specific memory size to different applications including PHP.
You’ll see the following error, When your WordPress requires more memory than the default allocated memory
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx By default, WordPress automatically tries to increase PHP memory limit if it is less than 64MB. However, 64MB is often not high enough.
Why does WordPress need more memory to begin with?
Before increasing the Memory Limit in WordPress, I want to encourage you to first try to uncover what is sucking up so much memory. The most common culprits are plugins and themes that use too many resources. Also scan everything with wordfence or Sucuri.
How to Increase Memory Limit in WordPress?
You can increase wordpress memory limit and upload limit by editing php.ini file. This step requires some technical knowledge. However, you can do it yourself without the help of your web host. IF you are unable to access php.ini file then you can create user.ini file and put that file at root of the file manager.
Increase memory limit from your wp-config.php file
Wp-config.php is one of the most important WordPress file or we can say, it is the core file of wordpress, where your base configuration details are save. You’ll find it in the root of your WordPress file directory.
To increase the memory limit you need to add the following code in wp-config.php file.
define('WP_MEMORY_LIMIT', '128M');
Increase memory limit from PHP.ini file
if the memory limit doesn’t increase with the above code in wp-config.php, then you need to increase memory limit from PHP.ini file. To change the memory limit open php.ini file and check the following values.
memory_limit = 256M
upload_max_filesize = 12M
post_max_size = 13M
file_uploads = On
max_execution_time = 180
You can change the values according to your want.
Increase memory limit from .htaccess file
You should be using.htaccess instead of PHP.ini if you’re having problems with your server. If you still need to use the.php extension, then you’ll need to edit your.htaccess file. Add these lines:
php_value memory_limit 512M
How to Check the WordPress Memory Limit?
Once you’ve configured the memory limt, you might want to check if it worked. The next step is to access the WordPress dashboard, hover over tools, and select site health. Click on info and scroll down through all server settings. Find the php memory limit. The value you save for memory limit will reflect there.
Conclusion on WordPress memory limit
Changing the WordPress memory limit is fairly simple, if you follow the above steps. You’ll need to edit either your php.ini file, your wp-config.php file, or both. You may have to modify your.htaccess file as well. Finally, you can always ask your webhost to do it for you. If you like this article share it with your friends.
Checkout other article related to wordpress:-