cronjob not running with codeigniter
3:18PM is 15:18 Also, don't forget set full path to php interpreter:
18 15 * * * /usr/bin/php -f /var/www/html/index.php email_controller index
You should use the full path to the binary, its probably /usr/bin/php
but use whereis php
to get the correct path.
Besides that I don't see why this shouldn't be working. Does it work if ran manually?
Are you using crontab -e
to add the task? Make some tests with a debug script, make it run every minute with * * * * *
so you can debug it:
// debugcrontab.php<?php file_put_contents('Ran at ' . date('Y-m-d H:i:s') . "\n", '/tmp/debug.txt', FILE_APPEND);?>
In case it still fail try /bin/sh /usr/bin/php ...
I use this one in my server and it works just fine:
0 3 * * * /usr/bin/php /var/www/update_reports.php > /dev/null 2>&1
I had the same issue and after using correct PHP path it worked for me.
Use:
/usr/local/bin/php /home/username/public_html/index.php controllername methodname