Laravel中允许的内存大小为536870912字节 [英] Allowed memory size of 536870912 bytes exhausted in Laravel

查看:184
本文介绍了Laravel中允许的内存大小为536870912字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在同一系统中,我可以调用db,这没有问题,但是在某些情况下(使用最大的表),我得到了

In the same system, I can make call to db, and there is no problem, but in some case ( with the biggest table ), I get

"PHP致命错误:在/home/forge/sximo.sp-marketing.com/vendor/laravel/framework/src/Illuminate/Database/Connection中,耗尽了536870912字节的内存大小(尝试分配32字节).第311行上的php

"PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 32 bytes) in /home/forge/sximo.sp-marketing.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 311

我调试了代码,问题是一个基本查询:

I debugged the code and the problem is a basic query:

"  SELECT partidascapturainfo.* FROM partidascapturainfo    WHERE partidascapturainfo.partidascapturainfoid IS NOT NULL       ORDER BY partidascapturainfoid asc   LIMIT  0 , 10 "

当我在Mysql Client中运行查询时,查询运行时间为0.17s

When I run the query in a Mysql Client, query runs in 0.17s

我已经将memory_limit设置为2048,重新启动nginx,而我的查询仅返回10行...

I've already set memory_limit to 2048, restart nginx and my query only return 10 rows...

这是我的10行:

123044,42016,249,3762,2,,0
123045,42016,249,3761,2,,0
123046,42016,249,3764,1,,0
123047,42016,249,3765,,,0
123048,42016,249,3775,,,0
123049,42016,249,3771,3,,0
123050,42016,249,3772,3,,0
123051,42016,250,3844,HAY,,0
123052,42016,255,3852,,,0
123053,42017,249,3761,1,,0

有什么想法吗?

推荐答案

您可以尝试编辑/etc/php5/fpm/php.ini:

You can try editing /etc/php5/fpm/php.ini:

; Old Limit
; memory_limit = 512M

; New Limit
memory_limit = 2048M

您可能需要重新启动Nginx

You may need to restart nginx

您可能在某处也有无限循环.您可以张贴您正在调用的代码吗?

You may also have an infinite loop somewhere. Can you post the code you're calling?

这篇关于Laravel中允许的内存大小为536870912字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆