If you are using WordPress and noticing that your site is loading slowly, it might be because the memory limit on your hosting plan is too low. This article will teach you how to Increase WordPress Memory Limit if you need to load your website faster.
To Increase WordPress Memory Limit, you can do it (if you know how to manage it) or contact your hosting provider to increase the memory.
To do it your responsibility, you can manage it in a few ways:
4 Ways to Increase Your WordPress Memory Limit
Edit wp-config.php file
You can manually edit your wp-config.php file to define WordPress memory limit by adding this line after /* That’s all, stop editing! Happy blogging. */, Recommended WordPress Memory limit is 512MB
WordPress Memory Limit using htaccess file
Most web hosting companies do not allow you to modify the .htaccess file, and if they do, it can cause problems with your website. However, if they allow, open and edit the .htaccess file and set the value 512M for php_value_memory_limit. I would recommend using the first two steps because editing the .htaccess file may break your website.
php_value memory_limit 512M
Create/Edit PHP.ini file
Most web hosting companies do not allow you to modify the .htaccess file, and if they do, it can cause problems with your website. Increase Memory Limit through php.ini is a possibility, but only in rare cases as this feature isn't very commonly used by novices or those who don’t know what they are doing. Increase Memory Limit on servers.
If you have proper access, you can create/edit the php.ini file using FTP or cPanel. First, create a new php.ini file, If there is no php.ini file. But if php.ini exists there, edit the file.
Open the file in the editor and find the line for “memory_limit” making it 512M
memory_limit = 512M ;
Using cPanel PHP Setting.
Changing the PHP memory limit in cPanel is the easiest way (if you have the access to cPanel). First, login to your cPanel and find the MultiPHP INI Editor.
And set memory limit 512M.
Frequently Asked Questions about WordPress Memory Limit
What is WordPress Memory Exhausted Error?
Suppose you are experiencing the “wp-memory-exhausted” error when browsing your site. In that case, it usually means that your hosting plan does not have enough memory to handle all of the plugins and/or widgets on your website. Then it will show an error like this.
Fatal error: The allowed memory size of 563432 bytes exhausted (tried to allocate 1588617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php online xxx
How to check WordPress memory limit
You can check the WordPress memory limit from WordPress Dashboard > WooCommerce > Status. Also, you can check the wp-config.php file. Alternatively, you can use a WordPress plugin WP Memory to check the site's health in a better way.
What is WordPress Memory Limit?
This is the total amount of memory your website will be allowed to utilize at one given time, and you want this number to be as high as possible within your hosting plan's limitations.
WordPress is coded in PHP, a programming language that uses memory for running. Therefore, when you use WordPress, it will make demands on your hosting plan's Memory Limit to run plugins & widgets, load content from the database (such as posts or pages), etc..
When a visitor comes to your site, WordPress loads on their browser. This places many demands on the server's memory since each page must be loaded from scratch for this user alone. Increase Memory Limit in WordPress by increasing its own limit and other plugins' limits that you may have installed onto your website.
The default WordPress, max memory limit, is set at 64 megabytes – which on most shared hosting plans should be more than enough for a small WordPress website. Increase WordPress Memory Limit by increasing the number after that line of code to 256 or 512, for example:
Save your changes, and your site should be up and running in no time!
Can I Increase WordPress Memory Limit?
Yes, it is possible to Increase WordPress Memory Limit by modifying the wp-config.php file provided on your hosting plan's cPanel dashboard via FTP or File Manager (if you are allowed access). If not: contact your Hosting Provider.
You can do it or contact your hosting provider. If you have enough knowledge about server settings, you can manage it; otherwise, it's better to contact your hosting provider to increase WordPress memory limit.
If you don’t want to edit the wp-config.php file manually, then your hosting provider should be able to increase the memory limit for you. There are a few things that can affect WordPress performance, and one of them is the memory limit. Increase memory limit if you’ve been running out of memory when your blog starts to get more visitors and traffic from search engines. Increase Memory Limit on servers
Increasing the WordPress Memory limit in server resources is a trade-off with performance, so it's essential that this value not be set too high for the host/server to handle. We have a list of WordPress hosting providers on our blog, and you can check the list. That might be helpful for you to choose the best hosting for your business.