PHP增加memory_limit的128M以上 [英] PHP increase memory_limit above 128M
问题描述
我已经运行一个Debian挤压与标准Apache和PHP,通过资质安装。
I have running a Debian Squeeze with Standard Apache and PHP, installed via aptitude.
没有我尝试运行:
<?php
echo ini_get("memory_limit")."\n";
ini_set("memory_limit","1024M");
echo ini_get("memory_limit")."\n";
?>
结果:128M 128M
Result: 128M 128M
我曾试图改变这种行为和一些事实:
What I have tried to change this behavior and some facts:
/etc/php5/apache2/php.ini:
safe_mode = Off
memory_limit = 128M
/etc/php5/apache2/conf.d/suhosin.ini:
[suhosin]
suhosin.memory_limit = 2048M
我可以验证与此的phpinfo设置();, 服务的Apache2重启后
。
为什么我不能设置128M以上的内存限制?
Why I can not set the Memory Limit above 128M?
请注意:
<?php
echo ini_get("memory_limit")."\n";
ini_set("memory_limit","127M");
echo ini_get("memory_limit")."\n";
?>
结果:128M 127M
Result: 128M 127M
亲切的问候
推荐答案
修改 memory_limit的
是由扩展了Suhosin受阻。
Changing of memory_limit
is blocked by suhosin extension.
从文档在: HTTP://www.hardened-php .NET /了Suhosin / configuration.html#suhosin.memory_limit
suhosin.memory_limit
suhosin.memory_limit
类型:整数
默认值:0
只要脚本没有内运行
safe_mode设置他们可以自由地memory_limit的改变任何值
他们要。改变了Suhosin这一事实,并禁止设置
memory_limit的比所述一个脚本开始具有更大的值,
当这个选项则留在0值大于0,意味着
意志了Suhosin不允许脚本memory_limit的设置为一个值
高于此配置的硬限制。这例如有用如果
想与16M,但图像的限制normaly运行脚本
处理脚本可以将它提升到20M。
Type: Integer Default: 0 As long scripts are not running within safe_mode they are free to change the memory_limit to whatever value they want. Suhosin changes this fact and disallows setting the memory_limit to a value greater than the one the script started with, when this option is left at 0. A value greater than 0 means that Suhosin will disallows scripts setting the memory_limit to a value above this configured hard limit. This is for example usefull if you want to run the script normaly with a limit of 16M but image processing scripts may raise it to 20M.
所以启用了Suhosin扩展,您需要更改它,并重新启动Apache。
So with suhosin extension enabled, you need to change it and restart apache.
这篇关于PHP增加memory_limit的128M以上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!