Where to edit to increase memory in PHP ini file?

Hi, I have a PHP script that reads a text file. when the text file size exceeds a certain script limit, it gives an error and stops. when I divide the files into two, it works. so where are the settings in php to increase read memory?

+4
source share
2 answers

The parameter 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 one script, which causes problems:

 ini_set('memory_limit', '64M'); 
+11
source

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

1) A quick fix is ​​to add the following line to your .htaccess root directory:

 php_value memory_limit 32M 

2) In your PHP configuration file (php.ini) - Location depends on Apache / server settings. Find the file for memory_limit and change it to the desired value:

 memory_limit= 32M 

Then restart the Apache server.


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

 ini_set('memory_limit', '32M'); 
+4
source

Source: https://habr.com/ru/post/1335127/


All Articles