This will set your memory limit to 16 MB, rather than 8 MB. You can, and should, fiddle with this number so that it is as low as possible without repeating that error message. This will only alter the memory limit for that particular PHP file. Alternately, you can alter your php.ini file to up the memory limit. This will affect all scripts on your server. Simply open php.ini and find the line that reads “memory_limit” and alter it:

I’ve noticed in my own PHP.ini file that my default is much higher at 128M. So, if I were to ever receive this error message it would read: “Fatal error: Allowed memory size of 134217728 bytes exhausted…” and obviously be a much bigger problem. But it has the same workaround as “Fatal error: Allowed memory size of 8388608 bytes exhausted…” or “Fatal error: Allowed memory size of 16777216 bytes exhausted…” or whatever. Apparently, the  memory_limit default was upped from 8M to 16M in PHP 5.2.0 and is now 128M for PHP 5.3.0, which would explain why you may not get this error message at all. You can also disable the memory limit by setting memory_limit to –1 in PHP.ini. This isn’t usually a good idea, though, for obvious reasons. Note: You can also use the memory_limit line in your .htaccess page. Now, remember, this is only a workaround. Really, your PHP script should not be exceeding 8 MB, unless your uploading files or doing something else that’s obviously taking up a lot of memory usage. What you should really be doing is trying to figure out why your script is using so much memory and attempt to fix it. One way to figure out how much memory your PHP script is using is to use the memory_get_usage() PHP function. Simply echo it at any point in your script to find out where your memory usage is spiking: If you’re getting this error message in Drupal or Joomla, the likely culprit is a new module or package. For example, in Drupal, the admin/modules page loads every module in your Drupal installation, which can get hairy if a custom module is buggy, corrupt or hacked. Try disabling modules one by one to identify which is bringing the party down. Also, some hosting providers will ignore your attempts to modify the memory limits for your PHP code so you might need to contact your hosting support to assist you. I’ve found sometimes I need to edit the php.ini file and sometimes put the code into the .htaccess file. Either way, hopefully, this info here is enough to get you on your way! Could you advise? Thanks, in advance! Basically, there are three fixes that should be use separately (use just one–not all three):

  1. Add ini_set(“memory_limit”,”16M“); to the beginning of your individual PHP file that causes the error. For example, if index.php is causing the error, add to the top of index.php. This will only apply the memory limit change to that file. 2. Change the memory_limit= line in your php.ini file. You may not have access to this, depending on your web hosting package. You may need to contact your administrator. This is a site-wide change that affects your entire PHP installation. 3. Add the memory_limit= line to your .htaccess file (or create a .htaccess file and put it in the folder where you want it to be applied). This may be a better option if you don’t have access to php.ini. This will be a directory-wide change. Say, if you add it to the .htaccess file of yourwebsite.com/section1 it’ll only affect php files in the /section1 subdirectory. Fatal error: Out of memory (allocated 66846720) (tried to allocate 35 bytes) in /home/maxlife/public_html/healthydinnerrecipesreview.com/wp-includes/meta.php on line 311 This is how it looked like when I added the line in my .htaccess file (root public_html): suPHP_ConfigPath /home/maxlife order allow,deny deny from all memory_limit = 128M It returned an internal server error. I removed the line and tried to revise instead, the other .htaccess file within the subdirectory in question. This is how it looked like after I added the line:

BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index.php$ – [L]

uploaded files RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ – [L] RewriteRule . index.php [L] memory_limit = 128M # END WordPress This didn’t work either. it returned again an internal server error. I also tried recommendations 1 & 2, I got the same fatal error message. What other free solutions can I explore please? Really need your help. Thanks! This was what I did: 
THIS TO BE ENTERED IN THE WP-CONFIG FILE WHICH IS IN THE ROOT OF THE WORDPRESS SETUP: ENTER AFTER:
define(‘ABSPATH’, dirname(FILE).’/’); THE FOLLOWING: define(‘WP_MEMORY_LIMIT’, ’64M’); I ALSO CREATED A PHP.INI WHICH I UPLOADED TO THE PLUGIN FOLDER IN WP-CONTENT: memory_limit = 128M; Maximum amount of memory a script may consume (64MB)
 max_execution_time = 45;
 upload_max_filesize = 10M;
 post_max_size = 20M; Hope this helps! -Kadiest Johnson http://www.google.com/support/installer/bin/answer.py?answer=126299 Thank you! What is your name that plugin reply comment? It is marvelous for community wordpress. Please what’s your plugin? I’m trying to set up a Joomla website LOCALLY by using a quickstart Responsive template (LightHouse). 1st of all, I got the Fatal error: Allowed memory size of 8388608 bytes exhausted, WHICH HAS BEEN SOLVED BY YOUR METHOD. Then I’m now getting this error Out of memory (allocated 1832910848) (tried to allocate 24576 bytes) in C:\xampp\htdocs\HospitalChapel\templates\lighthouse\index.php on line 40 I increased the memory limit in php.ini. file but to no avail Then I put a .htaccess file in the directory where the problem was generated and nothing happened. Pls how can I solve this problem This actually happens when I activate the Google Fonts wordpress plugin. Comment Name * Email *

Δ  Save my name and email and send me emails as new comments are made to this post.

How to Solve PHP Fatal error  Allowed memory size of 8388608 bytes exhausted - 9How to Solve PHP Fatal error  Allowed memory size of 8388608 bytes exhausted - 3How to Solve PHP Fatal error  Allowed memory size of 8388608 bytes exhausted - 21How to Solve PHP Fatal error  Allowed memory size of 8388608 bytes exhausted - 43How to Solve PHP Fatal error  Allowed memory size of 8388608 bytes exhausted - 61How to Solve PHP Fatal error  Allowed memory size of 8388608 bytes exhausted - 2