Laravel DB Insert Error: Allowed Memory Size Exhausted

喜夏-厌秋 提交于 2019-11-30 20:45:12

This error depicts that your PHP script has exhausted memory limit due to insufficient memory allocated for script.

You need to increase memory_limit using the ini_set function e.g ini_set('memory_limit','128M');

Erik

The accepted answer is fixing the symptom rather then the problem. The problem is the Laravel query log (in memory) is eating all your RAM when you execute such a large # of queries. See the answer here: https://stackoverflow.com/a/18776710/221745

Or, in brief, turn off query logging via:

DB::disableQueryLog()

Before executing 20k queries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!