Increase the WordPress PHP Memory Limit: A 3-Step Guide
2019 March 25th at 9:51
By default, the WordPress platform has a limit for uploading videos, images, and other files. This also can be said for your WordPress PHP memory.
If you run a site that is full of content and plugins, you may exhaust your PHP memory limit - and that leads to errors. Why?
WordPress default PHP memory is a modest 32MB or 64MB. Almost nothing in today's world. Since the memory is very limited, the PHP memory limit can be triggered by something as simple as the installation of a new plugin.
So, if you've ever seen errors such as...
- Fatal Error: PHP Allowed Memory Size Exhausted
- Fatal error: Allowed memory size of X bytes exhausted;
It's a sign that you need to increase your WordPress PHP memory limit.
Even though it can be a little tricky to fix, it is doable. Here's how to increase your WordPress PHP memory limit on your server so you can go back to business as usual.
- 1. Find the wp-config.php file
- 2. Edit the 'WP_MEMORY_LIMIT' line
- 3. Re-upload the wp-config.php file
- Alternative method: Update PHP memory using PHP Selector
- Alternative method: Contact your host
1. Find the wp-config.php file
You can access it through your hosting provider's control panel (usually cPanel). The file is, by default, located in your root directory.
However, before making any changes to your 'wp-config' file, I strongly recommend creating a full backup, in case of an error.
2. Edit the 'WP_MEMORY_LIMIT' line
There are two main ways of editing the 'wp-config' file: online or as a text file. To edit online, click 'Code Editor' at the top of the window. You could also download the file and work with it with any text editor and re-upload when you're done.
Open the file and find a line that defines the WordPress memory limit. The line looks like this and comes at the very end, immediately before the 'Happy Blogging!' line.
define ('WP_MEMORY_LIMIT', '32M');
In this case, we can see that the memory limit is set to only 32MB. As a standard, I advise changing that number to 256MB. You can allow a higher limit, but 256MB is usually enough for high-performance and high-content websites.
3. Reupload the wp-config.php file
If you worked with a text file - save the text file and upload it back to the root directory folder.
If you chose to edit online - save the file and clear your browser's cache.
And you're done! Your WordPress PHP memory limit is now increased and shouldn't cause any problems.
Alternative method: Update PHP memory using PHP Selector
Login to your cPanel, find 'Select PHP Option' and click on it.
You will be prompted with this table. You will not be able to edit most of the information on it, but you should be allowed to edit the memory_limit part.
Choose a number you want from the drop-down menu and save.
Alternative method: Contact your host
If you don't want to mess with the code yourself or the methods above didn't work, you can always contact your hosting provider and ask them to increase the PHP memory.
Most hosting providers will be able to assist you as this is one of the routine processes the support usually deals with.
Increasing WordPress PHP Memory Limit: Pick Your Option
All in all, when it comes to increasing WP memory limits, you have options. I recommend editing 'wp-config.php' file first, as it's the most straightforward solution to these errors. However, if you don't trust your coding skills or if it doesn't work - you can opt for updating PHP memory using PHP selector. But in this case, both methods require similar time and skills.
As a last resort if these methods fail - contact your hosting provider for assistance.
And if your provider can't help you with that, and you're stuck with your measly 32 megs - there are always some other web hosting options you can choose.
How to Fix “WordPress Not Sending Email” Error?
2019 March 19th
WordPress email errors are as common as they are frustrating. People most commonly experience one when WordPress fails to email copies of completed contact...