0

Debian bullseye, php 7.4. One of my cron jobs has the line:

30 1 * * * www-data /usr/bin/php /my/script.php > /dev/null

I'm getting the error

PHP Fatal error:  Allowed memory size of 157286400 bytes exhausted (tried to allocate 49152 bytes) in /my/script.php on line xy

I'm sure that the php.ini file used is /etc/php/7.4/cli/php.ini (tested with a cron job executing php -i | grep "Loaded Configuration File"), and in that file I have:

memory_limit = -1

Why am I getting the error?

Paolo Benvenuto
  • 241
  • 5
  • 13

1 Answers1

0

Usually that means there is something wrong with the script, if you read from somewhere try to limit the iteration. However, paste this line above the line that gives you error and should work.

ini_set('memory_limit', '-1');