PHP 5.3.3中的ini_set(“memory_limit”)根本不工作 [英] ini_set("memory_limit") in PHP 5.3.3 is not working at all
问题描述
我以前有这个工作:
echo ini_get(memory_limit)\\\
ini_set(memory_limit,256M);
echo ini_get(memory_limit)。\\\
;
这将输入:
<$ p $在命令执行的php脚本上,p>
32M
256M
线。
我从5.2更新到5.3,从现在开始,这个指令根本不起作用:这给我:
32M
32M
然后让我的脚本失败,导致致命错误...
我检查了php文档,并将其调用,并且我没有发现任何memory_limit已被弃用。
有没有人有解决方案?
更新,将suhosin.memory_limit的默认值从disabled更改为0(不会对memory_limit进行任何更新)。
在Debian上,更改/ etc / php5 / conf.d / suhosin.ini
; suhosin.memory_limit = 0
到
suhosin.memory_limit = 2G
或者你喜欢的任何值。您可以在 http://www.hardened-php.net/hphp找到Sushosin的更新日志/changelog.html ,其中说:
更改了memory_limit保护的实现方式
I had this working before :
echo ini_get("memory_limit")."\n";
ini_set("memory_limit","256M");
echo ini_get("memory_limit")."\n";
That would input this :
32M
256M
on a php script executed by command line. I updated from 5.2 to 5.3, and from now, this directive is not working at all : this gives me :
32M
32M
and then make my script fail with a fatal Error...
I checked the php documentation, and googled it, and I didn't find anywhere that "memory_limit" had been deprecated.
Does anyone have a solution?
Most likely your sushosin updated, which changed the default of suhosin.memory_limit from disabled to 0 (which won't allow any updates to memory_limit).
On Debian, change /etc/php5/conf.d/suhosin.ini
;suhosin.memory_limit = 0
to
suhosin.memory_limit = 2G
Or whichever value you are comfortable with. You can find the changelog of Sushosin at http://www.hardened-php.net/hphp/changelog.html, which says:
Changed the way the memory_limit protection is implemented
这篇关于PHP 5.3.3中的ini_set(“memory_limit”)根本不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!