How to Increase the WordPress PHP Memory Limit

>How to Increase the WordPress PHP Memory Limit
  • plus

Increasing your WordPress PHP memory limit can be the solution to several common WordPress errors, like memory exhaustion, white screen of death, HTTP error when trying to upload images, 500 internal server error, etc.

The default memory limit for WordPress is 40MB, and you can increase it by following one of the 3 ways pointed below.

Note that increasing your memory limit might not always take effect!

Increasing the WordPress PHP memory limit

1. Through wp-config.php

Here’s a detailed post on how to access and edit your WordPress files using 3 different methods.

This is the easiest and safest way. You just need to access your WordPress root directory and locate the wp-confing.php file.

To do that, you can use an FTP client, like SmartFTP or FileZilla, or use the File Manager from your hosting’s control panel (usually cPanel).

Here’s where you should end up:

increase wordpress php memory limit in wp-config

After you click Code Edit, you need to insert this code define('WP_MEMORY_LIMIT', '96M');, right before this line: /* That's all, stop editing! Happy blogging. */

You could also add 128M, 256M, or something else.

This may not work if your web host won’t allow you to increase your PHP memory limit!

Here’s a video guide that we made for you:

2. Through PHP.ini

Many hosting companies don’t allow access to the PHP.ini file, so you will have to contact them.

If you have access to the file, you need to add this code memory_limit = 96M (or 64M, 256M, etc.) there.

3. Through .htaccess

Back up the file before editing it.

You’ll find the .htaccess file on the WordPress root directory, where the wp-confing.php is.

Or, if you have the WordPress SEO by Yoast plugin, you can go to SEO -> Tools -> File Editor, and add the code there.

This is the code you should usually add in order to increase the WordPress PHP memory limit: php_value memory_limit 96M

If that code breaks the site, remove it and try this one:

<IfModule mod_php5.c>
php_value memory_limit 96M
</IfModule>

Here’s more about using such PHP commands in .htaccess.

Conclusion

Problems caused by memory limit are common, so you could increase it right now in order to prevent possible issues.

Even though there are 3 easy ways through which you can increase the WordPress PHP memory limit, the first one is the easiest and fastest method, so I recommend following that one.

I recommend backing up the files or the whole site before doing any changes!

Hope you found this post useful! Don’t forget to share it with others!

WP Rocket - WordPress Caching Plugin
By |2018-11-12T17:19:46+00:00December 4th, 2014|Tips, WordPress|0 Comments

Leave A Comment

SUBSCRIBE BEFORE YOU GO?

- Get guides and offers right into your inbox -

The type of emails that you would like to receive (multiple selection allowed):

You can unsubscribe at any time by clicking the link in the footer of the emails. For more information, please check the privacy policy.

I use MailChimp as my emailing service. By subscribing, you understand that your email and preferences will be transferred to MailChimp. Learn more about MailChimp's privacy practices here.

close-link