rss search

How to increase memory limit for WordPress


Last night I got the following error: Fatal error: Allowed memory size of xxxxx bytes exhausted when customized a theme in WordPress. I uploaded a php file with the following content:


When I ran it, I saw memory_limit is 32M. I decided to increase it to 64M.  I tried the following:

1. Add the following line to wp-config.php file:
define(‘WP_MEMORY_LIMIT’, ’64M’);
2. Update PHP.ini to add the following line:
memory_limit = 64M ;
3. Add the following  to an .htaccess file:
php_value memory_limit 64M

When I re-run the php file, memory limit still shows 32M. I searched lunarpages hosting that hosts my web sites and found the following link: increase php.ini upload limit

I did the similar thing for memory limit and it worked.

In .htaccess file, add the following lines

suPHP_ConfigPath  /home/username/public_html

<Files php.ini>
order allow,deny
deny from all

In php.ini file, add the following:

memory_limit = 64M




Leave a Comment

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