Answer the question
In order to leave comments, you need to log in
PHP script not working on CRON?
Hello.
Can you please tell me why the script on CRON does not work? Server on OS Ubuntu+PHP5. Several PHP scripts are launched on the server via CRON. Some of the scripts work fine, and some don't. It is precisely those scripts that run for a long time - 30-50+ seconds that do not work correctly.
Crontab -l:
# works fine
0 9 * * * /usr/bin/php5 /var/www/public_html/site1.com/www/poster.php
# works incorrectly
0 7 * * 1 /usr/bin/php5 /var /www/public_html/sub.site2.com/www/grab/script1.php 20 7 * * 1 /usr/bin/
php5
/var/www/public_html/sub.site2.com/www/grab/script2.php
cron logs (grep CRON /var/log/syslog) scripts run like normal:
CMD (/usr/bin/php5 /var/www/public_html/site1.com/www/poster.php)
CMD (/usr/bin/php5 /var/www/public_html/sub.site2.com/www/grab/ script1.php)
CMD (/usr/bin/php5 /var/www/public_html/sub.site2.com/www/grab/script2.php)
When run manually through a browser, everything works fine.
Previously, there was another glitch when cron ran large scripts several times instead of one 0 7 * * 1 , but they were not completely executed.
For scripts that run for a long time, I increased the time limits, but it doesn't help.
ignore_user_abort(true);
ini_set('max_execution_time', 600);
set_time_limit(600);
Answer the question
In order to leave comments, you need to log in
Have you tried running these commands in the console as the user who owns the specified crontab?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question