耗尽的允许内存大小为262144字节(尝试分配24576字节) [英] Allowed memory size of 262144 bytes exhausted (tried to allocate 24576 bytes)

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

问题描述

我为此而发疯.

我收到下一条消息:

Allowed memory size of 262144 bytes exhausted (tried to allocate 24576 bytes)

待办事项列表

检查phpinfo(),获得正确的php.ini路由并进行编辑. 将memory_limit更改为

Check phpinfo(), got the right php.ini route and edit it. Change memory_limit to

memory_limit = 128M

确保值memory_limit更改con phpinfo()的结果:

Make sure the value memory_limit changes con phpinfo() with the result:

memory_limit    128MB   128MB

检查.htaccess并添加(不需要)

Check .htaccess and added (not needed)

php_value memory_limit 128M

并且还可以通过php更改它(在错误行之前):

And also to change it via php like so (before error line):

ini_set('memory_limit','128M');

它说到处都将内存设置为128M,但仍然会收到该错误?

It says everywhere that memory is set to 128M, but still get that error?

错误出现在abstractSmtpTransport.php的Swift库(用于发送电子邮件的库)中,所以这不是我的代码int可以正常工作的原因.

The error is in Swift library (library for sending emails), in abstractSmtpTransport.php, so it's not my code int's suposed to work.

任何想法?

是的,以前的操作已经完成了重启apache的工作.

Yes, the previous was done restarting apache.

@patrick,补充说,但没有回音

EDIT 2: @patrick, added that but nothing was echoed

尝试使用较低的值,每个文件插入28M,重新启动apache,相同的错误(phpinfo显示了新的值)

Tryed with lower value, 28M int every file, restarted apache, same error (phpinfo showed new value)

尝试使用-1,重新启动,并且出现相同的错误.

tried with -1, restarting, and same error.

允许的内存大于分配的内存,这不是很奇怪吗? (尽管事实是允许的内存大小远低于分配的实际允许的内存)

EDIT 3: isn't it weird that allowed memory is bigger than allocated memory? (despite the fact that allowed memory size is way below real allowed memory asigned)

推荐答案

我看到我的问题与您的问题有些不同,但我会将此答案发布出来,以防它对其他人有所帮助.定义我的memory_limit时,我使用的是MB而不是M的速记,而php却默默地忽略了它.我将其更改为整数(以字节为单位),问题得以解决.

I see my problem is a little bit different from yours, but I'll post this answer in case it helps someone else. I was using MB as shorthand instead of M when defining my memory_limit, and php was silently ignoring it. I changed it to an integer (in bytes) and the problem was solved.

我的php.ini更改如下:memory_limit = 512MBmemory_limit = 536870912.这解决了我的问题.希望它对其他人有帮助!您可以在此处上阅读php的速记.

My php.ini changed as follows: memory_limit = 512MB to memory_limit = 536870912. This fixed my problem. Hope it helps with someone else's! You can read up on php's shorthand here.

祝你好运!

修改

正如Yaodong指出的那样,您可以轻松地使用正确的缩写"M",而不是使用字节值.我出于调试目的将我的值更改为字节值,然后又不费力地将其改回.

As Yaodong points out, you can just as easily use the correct shorthand, "M", instead of using byte values. I changed mine to byte values for debugging purposes and then didn't bother to change it back.

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

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