How to Solve “Allowed Memory Size of X Bytes Exhausted” Error

From this tutorial you’ll learn how to solve Allowed memory size of X bytes exhausted error.

Solving the Issue
  • If you’re facing this error, it means, that the set memory limit is not enough for the PHP script. Here X value is the value of memory limit configuration. Y is the value of the extra memory that is needed to make the script work.
  • First of all, you should contact your hosting server provider and ask to fix this issue for you in order to get proficient help.
  • The other way to solve the problem is to make changes in the php.ini file.
  • Change the memory limit value to 32M. Check the line of code below to make sure you’ve done everything correctly.
  • If you can’t apply changes to php.ini file, let’s make changes in the .htaccess file.“Allowed memory size of X bytes exhausted” error
  • Open it for editing and the following code in order to increase the memory limit.
  • As a result, the error won’t show up again.

Was this helpful?