So you got a memory error, something like:
“Fatal error: Allowed memory size of 12345678 bytes exhausted (tried to allocate 2345678 bytes) in /home/your-username/public_html/wp-includes/plugin.php on line…”
Don’t worry. You’ll be fine.
Themes are getting more robust and require more resources than the default limit WordPress gives you. And it appears that different hosts have different requirements, making it even more fun. Also, different blogs have different levels of expertise in showing you how to do it. Many say “Try this” or “try that, and if those don’t work, call your host.” Gee, thanks. Many sites do tell you what lines of code you need to add, but not WHERE – which matters as much as the lines themselves. Enough of my whining.
I will not assume you are a deep-level coder, but that you do know enough to do something like this.
Here’s how to upgrade the WordPress memory limit for sites on a GoDaddy Linux shared hosting environment, as of July 2016.
Step 1:
Make a full back-up of your files. It’s just a good habit to always do so before changing anything. If you don’t know how to do this you probably shouldn’t be messing with this.
Step 2:
Make a .zip copy of the back-up you just made. This gives you a fall-back option “just in case.”
Step 3:
In those backed-up files, locate a file in the root directory called “wp-config.php”. When you’ve located it, open it in your favorite code editor.
Step 4:
Add these 2 lines of code (I will show you where in Step 5):
define( ‘WP_MEMORY_LIMIT’, ‘256M’ );
define( ‘WP_MAX_MEMORY_LIMIT’, ‘256M’ );
Step 5:
HERE. Yes, it matters. Put it a couple lines below the WP_DEBUG line.
You’ll notice I didn’t say anything about php.ini or php5.ini files. They don’t matter on GoDaddy’s Linux shared hosting environment.
Step 6:
Now, get back to work.
I hope this was helpful.
Duff
Leave A Comment