PHP script execution exceeds the memory limit, although the limit is higher

I have a PHP script on a Linux server that I am executing using the command line like this: PHP .php

(note that it is not executed as part of a web request).

The file memory_limit

on the server "php.ini" has "512M" set and I checked it like this:

# echo "<?php phpinfo(); ?>" | php | grep memory_limit
memory_limit => 512M => 512M

      

Now the problem is that when I run the script through PHP .php

, over time I get the following error:

Fatal error: Allowed memory size 268435456 bytes exhausted (tried to allocate 600283 bytes) in ...

268435456 bytes ~ = 268mb, which is definitely below 512mb

What could be here? Is it possible that there is another system layer I am missing? Or php processes are inherently limited to ~ 268mb?

+3


source to share


2 answers


You can use php -i and grep to check that you have updated the correct php.ini,



php -i | grep php.ini

-1


source


Most likely the php.ini settings did not take effect. Restart the server one more time and run the script with phpinfo () to make sure your changes are in place.



-6


source







All Articles