Answer the question
In order to leave comments, you need to log in
How to raise memory_limit for php-cli?
Good day.
I'm trying to run a script that will roughly gobble up 3-4 gigabytes. On an OpenServer machine and php7.2 + apache. However, I get the error `Allowed memory size of 536870912 bytes exhausted`.
I tried:
- raising memory_limit in php.ini (then I did php --info in the same console, memory_limit in the response was equal to 4096, i.e. everything, in theory, is super)
- pass the parameter in the console itself, like this `php -d memory_limit=4096M script.php`, and also `php -d memory_limit=4096 script.php`
- write ini_set("memory_limit", "4096M") on the first line of the most launched script.
This does not work. After restarting the server, it still swears at the 512 megabyte limit. What did I miss? How to raise?
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
cli may use ANOTHER php.ini
run under cli phpinfo or php -i and check.
Also suhosin.memory_limit, if set, can override this value.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question