如何避免PHP内存耗尽? [英] How to avoid PHP memory exhaustion?

查看:83
本文介绍了如何避免PHP内存耗尽?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

致命错误:在第166行的/home/alien/Desktop/1/scanner.php中,允许的内存大小为33554432字节已用尽(试图分配136753字节)

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 136753 bytes) in /home/alien/Desktop/1/scanner.php on line 166

这是166行PHP代码:

this is 166 line of the PHP code:

 $text[$i] =  curl_multi_getcontent ($curl[$i]);

这里有任何方法可以通过清空RAM或其他方式来解决此问题,对不起,我不是程序员

is here any way to get around this by emptying RAM or something, sorry I'm not a programmer

推荐答案

似乎您的服务器配置了32MB分配给PHP的内存.在不了解您的应用程序的情况下,这听上去很合理,但是肯定有一些应用程序需要更多.

It looks like your server is configured with 32MB of memory allocated to PHP. Without knowing more about your app, that sounds like a reasonable amount, but there are certainly apps that require more.

在您的php.ini文件中,您可以增加内存限制,如下所示:

In your php.ini file, you can increase the memory limit, like so:

memory_limit = 64M

请注意,持续增加分配给应用程序的内存量通常是更大问题的征兆.您可能还希望开发人员仔细检查代码中是否有未正确清理的数据.

Note that consistently increasing the amount of memory allocated to your application is often the sign of a bigger problem. You might also want a developer to look through the code for any data that is not being properly cleaned up.

这篇关于如何避免PHP内存耗尽?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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