PHP Fatal error: Allowed memory size of x bytes exhausted (tried to allocate … bytes) in

This Comment will be submitted for moderation and will not be accessible to other users until it has been approved.


21 points

I am getting "PHP Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate … bytes) in test.php" error in my php script. What does this error mean? How do I fix it?



7 points

Locate your php.ini which is your php configuration file and increase the parameter memory_limit to 32M or 64M. Restart apache and that should solve your problem.

Anonymous's picture
Created by Anonymous
0 points

I am on a shared hosting. Where is php.ini?

Anonymous's picture
Created by Anonymous
-6 points

2 things, you can try:

1. Contact your hosting provider.
2. Try increasing this limit in your .htaccess files as follows and see if that works:
php_value memory_limit 64M

Anonymous's picture
Created by Anonymous

Post Comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.