Increase PHP Memory Limit

To increase memory, you can use different methods. Examples bellow are for 64MB of memory. You can set it lower and experiment with higher values. Setting this to 128M or 256M or more is fine also, PHP will really use as needed, this value is the limit. Use only one of these methods, don’t use all of them in the same time!

Method 1: Change PHP.ini

On some shared hosting servers and on VPS or other dedicated hostings, you will have access to php.ini file with all main PHP settings. This file should have memory directive, so you need to find it and change it, if it is not there, you need to add it. Here is the directive you need to find/add and set different value for memory size:

memory_limit = 64M

Method 2: Use .htaccess

If you don’t have access to php.ini, same thing can be done using .htaccess file. This file is in the root folder of your website, if it’s not there you can add it, but in most cases it is added by WordPress. This file is only available on Apache servers. Again, search for this in that file, if it is not there add it, and set memory value you need:

php_value memory_limit 64M

Method 3: Use WordPress wp-config.php

WordPress way to do this is using almighty wp-config.php file. If this define is in the file, change it to memory value you want, if it’s not there add it before “That’s all, stop editing!” comment in that file. Here is the code to find and change or add if not there.

define('WP_MEMORY_LIMIT', '64M');

Method 4: Contact your hosting company

If you don’t want to do it on your own, you can always contact your hosting company support. Some hosting companies can impose limit to this value, so whatever you try to change it will fail, and only hosting support can change it for you (if they want to). If you can’t change memory limit, it is time to find some better hosting that will allow you to do so.

Rate this article

You must be logged in to rate this.

0
0
1542

Leave a Reply

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