ini_set(“memory_limit”) in PHP 5.3.3 is not working at all

前端 未结 6 1182
长发绾君心
长发绾君心 2020-11-28 10:57

I had this working before :

echo ini_get(\"memory_limit\").\"\\n\";
ini_set(\"memory_limit\",\"256M\");
echo ini_get(\"memory_limit\").\"\\n\";
6条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-28 11:45

    Ubuntu 10.04 comes with the Suhosin patch only, which does not give you configuration options. But you can install php5-suhosin to solve this:

    apt-get update
    apt-get install php5-suhosin
    

    Now you can edit /etc/php5/conf.d/suhosin.ini and set:

    suhosin.memory_limit = 1G
    

    Then using ini_set will work in a script:

    ini_set('memory_limit', '256M');
    

提交回复
热议问题