I'm getting email errors from a cron, on Ubuntu, that lives at:
/etc/cron.d/php5
I didn't install that cron, so I'm guessing it is installed with PHP. Its contents are as follows:
# /etc/cron.d/php5: crontab fragment for php5
# This purges session files older than X, where X is defined in seconds
# as the largest value of session.gc_maxlifetime from all your php.ini
# files, or 24 minutes if not defined. See /usr/lib/php5/maxlifetime
# Look for and purge old sessions every 30 minutes
09,39 * * * * root [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +\
$(/usr/lib/php5/maxlifetime) -delete
It seems to be the cron that kills old sessions.
It is however, sending me this email error:
To: root
Subject: Cron <root@mailserver> [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) -delete (failed)
Message:
PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 523800 bytes) in Unknown on line 0
find: invalid argument `-delete' to `-cmin'
Does anyone know how to go about remedying this?
EDIT: I know that 262144 bytes is not very much, so perhaps I should just bump up the memory limit? I figure that is a workaround, but I was just curious as to why these errors suddenly started popping up. There are never actually any $_SESSION
s created on this server, it's only used to send email.
/usr/lib/php5/maxlifetime
script being called. What happens when you run that manually? How are you running PHP on your system? Are you using mod_php, cgi, fcgi, or something else? Anyway, look at that script, and figure out where it is breaking.php5 -c /etc/php5/apache2/php.ini -r 'print ini_get("session.gc_maxlifetime");'
memory_limit = 1024MB
, and running just:php5 -c /etc/php5/apache2/php.ini -r 'echo "here";'
causes the same error,PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 523800 bytes) in Unknown on line 0 Could not startup.
1024MB
, instead of1024M
. The value was illegal. Since I don't run it as an Apache module, I never knew. I'll just update maxlifetime.sh to use the cli config. Thanks!