My OpenCart Website is Displaying Following Message: “Allowed Memory Size Exhausted”

Share It

These kinds of errors happen because your hosting/database memory is not enough to execute the PHP code(s) (due to uploading large uncompressed images, upload/deletion of lots of products, sending bulk emails etc). Just increasing the memory allocated for PHP will solve the issue.

typical error variant(s):
  • Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 47200 bytes) in /path/public_html/system/library/image.php on line 34
  • Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 13069817 bytes) in /path/public_html/system/library/mail.php on line 144
  • Fatal error: Out of memory (allocated 33554432) (tried to allocate 14024 bytes) in /path/public_html/library/image.php on line 34
Solution:
Apply one of the solutions below to increase the limit to 64MB, 128MB, 256MB or 512MB – depending upon your hosting.
  1. Edit php.ini
    memory_limit = 128M;
  2. Or copy the code below to .htaccess
    php_value memory_limit 128M
  3. If you see this error frequently and none of the above solutions work, contact your hosting provider to increase your website’s memory allocation. If you are using shared hosting, there is maximum memory limit. You can’t set memory-limit to 64Mb if you have got max 32Mb in your hosting package.