ini_set('memory_limit', …) doesn't work and returns false; can't figure out why

≡放荡痞女 提交于 2019-11-30 05:17:37

问题


ini_set('memory_limit', '128M'); // Returns false; memory_limit unchanged

I wasn't able to find a list of things that can cause this. So far I checked:

  • Safe mode: disabled
  • disable_functions: Empty
  • php_admin_value: None that I could find (is there a way to know for sure?)

I ran out of ideas! ini_set works correctly with other parameters (such as "display_errors")


回答1:


If it's not the PHP version problem posted already try checking that there's nothing on the machine preventing your from raising this limit.

How to check whether Suhosin is installed?

edit (after establishing that Suhosin is installed):

Config details are here: http://www.hardened-php.net/suhosin/configuration.html I suspect there'll be a file in /etc/php.d/ that you can edit to increase the memory limit bounds. The config variable you need to edit is: suhosin.memory_limit




回答2:


The manual says :

Prior to PHP 5.2.1, in order to use this directive it had to be enabled at compile time by using --enable-memory-limit in the configure line

That might be the cause of your problem.



来源:https://stackoverflow.com/questions/5859994/ini-setmemory-limit-doesnt-work-and-returns-false-cant-figure-out-wh

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!