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

前端 未结 2 630
梦毁少年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');
    
    0 讨论(0)
  • 2020-12-11 22:15

    The setting is memory_limit and you can change it in the php.ini file for all scripts, or (better) just change it in the code for the one script that is causing you problems:

    ini_set('memory_limit', '64M');
    
    0 讨论(0)
提交回复
热议问题