简体   繁体   English

Centos 6,PHP,Apache,CPanel memory_limit不会增加

[英]Centos 6, PHP, apache, CPanel memory_limit won't increase

When running a certain PHP script which needs a lot of memory I'm getting the "Out of memory (allocated 137887744) (tried to allocate 93 bytes) in..." error. 运行某些需要大量内存的PHP脚本时,出现“内存不足(已分配137887744)(试图分配93字节)的信息……”错误。

I've tried increasing this in all places I know how.. 我尝试在所有我知道的地方都增加它。

php.ini, duplicated php.ini into local folder and increased here. php.ini,将php.ini复制到本地文件夹并在此处增加。 ini_set() on in the script file etc. 脚本文件中的ini_set()等。

phpinfo says memory is 512M. phpinfo表示内存为512M。

Is there any suggestions of what I can do to increase the memory? 我对增加内存有什么建议?

Thanks, Martin. 谢谢,马丁。

This isn't because of PHP per-se (as Pekka says in the comments). 这不是因为PHP本身(如Pekka在评论中所说)。 The error message from the ini setting references "Allowed Memory" being exceeded, and this is a straight "out of memory". 来自ini设置的错误消息引用了“允许的内存”已超过,这是直接的“内存不足”。 Changing the ini setting won't work. 更改ini设置无效。

Priority number 1 is to check your script. 优先级1是检查您的脚本。 Unless you handling images or some very large files, you shouldn't get anywhere near that memory requirements. 除非您处理图像或一些非常大的文件,否则您应该不会满足该内存需求。 Just double check that bit first. 请先仔细检查该位。

Option 2: You need to allow for memory for Apache / PHP to play in (assuming you can't optomise your script. You are probably running a VPS or other restriction on the memory your user can use - there is a file called "limits.conf" (in security directory, man limits.conf for more) and also a memory management application smem that can restrict per user. So go to your hosting and get those increased - but if you're on a shared server, they will be asking why and probably want you to upgrade! 选项2:您需要为Apache / PHP提供足够的内存来播放(假设您无法对脚本进行修改。您可能正在对用户可以使用的内存运行VPS或其他限制-有一个名为“ limits”的文件“ .conf”(在安全目录中, man limits.conf可获得更多信息),以及可以限制每个用户的内存管理应用程序smem。因此,请转到您的托管服务器并增加它们-但如果您在共享服务器上,它们将问为什么,可能要你升级!

Maybe this helps someone. 也许这可以帮助某人。 I had the same issue. 我遇到过同样的问题。 Everything I read indicated this was caused by RLimitMEM settings in Apache. 我阅读的所有内容均表明这是由Apache中的RLimitMEM设置引起的。 This did not solve the issue for me. 这没有为我解决问题。 After days of pulling my hair out, I finally fixed the issue by discovering and editing /usr/local/apache/conf/rlimit-config 经过几天的努力,我终于通过发现和编辑/ usr / local / apache / conf / rlimit-config解决了该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM