允许的内存大小为33554432字节已用尽(尝试分配12个字节) [英] Allowed memory size of 33554432 bytes exhausted (tried to allocate 12 bytes)

查看:746
本文介绍了允许的内存大小为33554432字节已用尽(尝试分配12个字节)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
允许的内存大小为33554432字节已耗尽(试图在php中分配43148176字节)

Possible Duplicate:
Allowed memory size of 33554432 bytes exhausted (tried to allocate 43148176 bytes) in php

我正在尝试运行该程序,但是我一直收到此错误; 致命错误:耗尽了33554432字节的允许内存大小(尝试分配12个字节) 请帮我

i m tring to run the program, but I keep getting this error; Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 12 bytes) plz, help me

推荐答案

这里是一个简单的教程,可以正常工作.

Here is a simple tutorial here it will work.

当内存需求超过默认的8MB限制时,此错误消息会在以前起作用的PHP脚本中弹出.不过请不要担心,因为这是一个容易解决的问题.

This error message can spring up in a previously functional PHP script when the memory requirements exceed the default 8MB limit. Don’t fret, though, because this is an easy problem to overcome.

要通过在脚本顶部添加如下一行来更改一个特定脚本的内存限制,请执行以下操作:

To change the memory limit for one specific script by including a line such as this at the top of the script:

ini_set("memory_limit","12M");

12M将限制设置为12兆字节(12582912字节).如果这不起作用,请继续增加内存限制,直到脚本适合或服务器发出怜悯的声音为止.

The 12M sets the limit to 12 megabytes (12582912 bytes). If this doesn’t work, keep increasing the memory limit until your script fits or your server squeals for mercy.

您还可以对服务器上运行的所有PHP脚本进行永久更改,方法是在服务器的php.ini文件中添加如下一行:

You can also make this change permanently for all PHP scripts running on the server by adding a line like this to the server’s php.ini file:

memory_limit = 12M

请记住,巨大的内存限制不能很好地替代良好的编码.脚本写得不好可能会浪费内存,这对于频繁执行的脚本可能会造成严重的问题.但是,某些应用程序很少运行,并且需要大量内存,例如导入和处理大数据文件.

Keep in mind that a huge memory limit is a poor substitute for good coding. A poorly written script may inefficiently squander memory which can cause severe problems for frequently executed scripts. However, some applications are run infrequently and require lots of memory like importing and processing a big data file.

如果您需要更多帮助,请随时在此处回复.

In case you need any more help please do not hesitate to reply here.

这篇关于允许的内存大小为33554432字节已用尽(尝试分配12个字节)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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