出现这个错误消息,有什么建议吗?
允许内存大小为33554432字节已耗尽(已尝试分配 43148176字节)的PHP
出现这个错误消息,有什么建议吗?
允许内存大小为33554432字节已耗尽(已尝试分配 43148176字节)的PHP
当前回答
我们也遇到过类似的情况,我们尝试了顶部给出的答案 报错(' memory_limit ', ' 1 '); 一切工作正常,压缩图像文件大于1MB到KBs。
其他回答
COMPOSER_MEMORY_LIMIT=-1 composer require mageplaza/module-core
我运行以下命令编写器更新,现在正在工作。如果它不能解决你的问题,增加你的内存限制在memory_limit在php.ini文件。
在Wordpress中切换到一个新主题后,我收到了同样的错误信息。PHP运行的是5.3版本,所以我切换到了7.2。这解决了问题。
It is unfortunately easy to program in PHP in a way that consumes memory faster than you realise. Copying strings, arrays and objects instead of using references will do it, though PHP 5 is supposed to do this more automatically than in PHP 4. But dealing with your data set in entirety over several steps is also wasteful compared to processing the smallest logical unit at a time. The classic example is working with large resultsets from a database: most programmers fetch the entire resultset into an array and then loop over it one or more times with foreach(). It is much more memory efficient to use a while() loop to fetch and process one row at a time. The same thing applies to processing a file.
Wordpress用户添加一行:
@ini_set('memory_limit', '-1');
or
在cpanel中设置memory_limit为-1