WordPress Tutorials

How to Increase PHP memory Limit

You can fix most of the WordPress common errors like a blank screen, HTTP error, just by increasing PHP memory limit. In this article, I will show you how to increase PHP memory limit for your WordPress application.

You need to have access to FTP and basic knowledge of how to use file transfer protocol. There are number of ways to increase PHP memory limit listed below. of course, You only need to use one of them

1. Edit your wp-config.php file

find wp-config.php file right click and choose option view/edit Add below code to the very bottom, right before the line that says, “Happy Blogging”:

define(‘WP_MEMORY_LIMIT’, ‘256M’);

It will open the file in notepad after you enter the above code close the notepad. It will ask you “do you want to save file” Click yes and you are done.

Note: WordPress memory can be different from the server – you need to set this regardless of server memory settings

2. Edit your PHP.ini file

Sometimes there is no php.ini file and that’s ok. You can create one in notepad and save it as php.ini and add the below code in your php.ini file If you have access to your PHP.ini file already, change the line in PHP.ini
If your line shows 64M try 256M:

memory_limit = 256M ;

Please note, 256 in the above code is php memory limit to process something on your server.  256 MB is enough for normal WordPress website. You could try just 128M only if it works, to be on safe side

PHP memory limit should be set as low as possible like 128 Mb may be or  within the bounds of what you need. The memory limit is applied to each individual concurrently executing script, not globally. Setting it low will help ensure that if you make some mistake that causes e.g. an infinite loop, the script will be stop early rather than spiralling out of control and grinding the entire server to a halt.

3. Edit your .htaccess file

If you don’t have access to PHP.ini try adding this to an .htaccess file, normally at very bottom or top of the other code. Be careful don’t add any code between existing code

php_value memory_limit 256M

4. Contact Your Host

If you are not comfortable in trying the above methods, or the above did not work for you, you need to talk to your hosting about having them increase your memory limit. After all you are paying them :p .

Show More

Related Articles

Close