Skip to content
Advertisement

cronjob not running with codeigniter

I am sure the answer is right in front of me, but this is driving me crazy. I have searched high and low for the answer and can’t find it. Essentially I am trying to run a script through a cronjob on my server and nothing is working. However, when I run it with the PHP command line, it works fine.

The desired effect is to send an email periodically. So, when I run this:

php /var/www/html/index.php email_controller index

The email sends and everything works fine. I am calling the email_controller controller and the index method. The index method isn’t necessary and works if I leave it off as well.

My crontab looks like this:

18 15 * * * php /var/www/html/index.php email_controller index

To run the script at 3:18 PM. This does not work. cron is running, I’ve checked.

Any ideas here?

Advertisement

Answer

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
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement