开发者

PHP memory exhausted although memory limit not reached

I am currently debugging a php-script. I set the memory_limit to 64M and it confirms this:

ini_set("memory_limit","64M");
echo "starting script with ".ini_get("memory_limit")."Bytes of ram\n"; \\64

But nevertheless the script breaks using just 20M giving the standard memory exhausted error.

Fatal error: Allowed memory size of 20971520 byte exhausted

Is there a possibility I probably did not thin开发者_如何学Pythonk of ? Maybe Apache is setting something for PHP ?


Better try this for unlimited memory:

ini_set("memory_limit",-1)


maybe the safe_mode is enabled on your server - if so, a lot of settings can't be changed using ini_set(). please take a look at your php.ini and check that.

EDIT: what happens if you change the value for memory_limit in the php.ini directly and restart/reload your apache (or whatever)? does it work in that case?

EDIT2 to wuschelhases comment:

  • have you restarted the apache after changing the php.ini? are you really sure you changed the correct php.ini (there may be not only one)?
  • what OS are your running (is this a linux-server, windows-server or a simple xampp-installation on your windows-home-pc)?
  • what does phpinfo() say about the memory-limit?
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜