increase php memory limit

How to Increase PHP memory Limit

  1. wp-config.php file
  2. php.ini file
  3. .htacess file

You can fix most of the WordPress common errors like a blank screen, HTTP error, just by increasing the PHP memory limit.

In this article, I will show you how to increase the PHP memory limit for your WordPress application.

You need to have access to FTP and basic knowledge of how to use file transfer protocol.

Increase php memory limit

There is a number of ways to increase the 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.

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 a new file 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 a normal WordPress website.

You could try just 128M only if it works, to be on the 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 a 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 stopped 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 a .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 ????.

Leave a Reply

Your email address will not be published. Required fields are marked *