首页 > 解决方案 > 如何解决 OpenCart 中的内存分配错误?

问题描述

OpenCart 中出现以下错误:

Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 8192 bytes)

文件:\system\storage\vendor\twig\twig\lib\Twig\Extension\Core.php 第 149 行

我不明白这是什么意思,因为分配的内存小于允许的大小。我该如何解决?

标签: phpopencartdynamic-memory-allocation

解决方案


从 opencart 文件夹编辑 php.ini 文件并增加“memory_limit”的大小,直到错误消失

memory_limit = 128M;

或者

编辑“config.php”和“admin/config.php”在最后添加以下代码

ini_set('memory_limit', '128M');

推荐阅读