简体   繁体   中英

Trouble with Codeigniter Cron Job

I am haveing trouble with getting a cron job to work with codeigniter

I have used these instructions. https://www.codeigniter.com/user_guide/general/cli.html But it is not working

Here is what I have.

php /home4/markwolf/public_html/propalert.asia/index.php admin_notifications index

But it is not finding the right controller or the method, instead it is going to the "default_controler". Everything else I've tried gets a 404 not found error.

I've been pulling my hair out for two days trying to get this to work so any help would be greatly appreciated.

Thanks

EDIT

This works:

wget -q http://propalert.asia/admin_notifications

But the problem with this method is that Codeigniter's method for protecting the script by checking whether it is accessed by cli returns false.

I came across this post at CI's forum describing the same problem.

https://ellislab.com/forums/viewthread/236475/#1055830

Unfortunately he never got an answer there either.

I finally found the solution:

/usr/bin/php-cli -q /home4/markwolf/public_html/propalert.asia/index.php admin_notifications index

the key is "php-cli" instead of "php".

But then there is a bug in the CI core that needs to be fixed. You can find the solution to that here:

https://ellislab.com/forums/viewthread/227672/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM