Score:0

php memory_limity = -1 not respected?

th flag

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?

Score:0
ng flag

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');
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.