Where to edit for increase in memory in PHP ini file?

前端 未结 2 661
梦毁少年i
梦毁少年i 2020-12-11 21:59

Hi I do have a PHP script which reads text file. when text file size is above the certain limit script gives error and stops. when I divide files into two it works. so where

2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-11 22:07

    There are three ways to change the memory_limit for your PHP script(s):

    1) A quick solution would be to add the following line into your root directory .htaccess file:

    php_value memory_limit 32M
    

    2) In your PHP Config file (php.ini) -- Location depends on your Apache/server setup. Search the file for memory_limit and change to your desired value:

    memory_limit= 32M
    

    Then restart your apache server.


    3) You can also specify the memory limit in your PHP script:

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

提交回复
热议问题