How to set cron job url for codeigniter?

Solution 1:

Use:

php index.php welcome show

as command in your crontab. E.g.:

0 * * * * php /home/username/index.php welcome show

Source (ver. 2.2.0) http://www.codeigniter.com/userguide2/general/cli.html

Source (ver. 3.*) http://www.codeigniter.com/user_guide/general/cli.html

Source (ver. 4.*) http://codeigniter.com/user_guide/cli/cli.html

Solution 2:

I have used below cron

php /full-path-to-cron-file/cron.php /test/index

source: http://www.asim.pk/2009/05/14/creating-and-installing-crontabs-using-codeigniter/

This works for me.

Thanks to all

Solution 3:

You can try with this one:

wget api.example.com/index.php/controller/function

Solution 4:

You can also try:

0 * * * * /usr/bin/curl --silent --compressed http://my-domain.com/welcome/show

Or localhost

0 * * * * /usr/bin/curl --silent --compressed http://localhost/welcome/show

I hope that is helpful.

Solution 5:

/usr/local/bin/php /home/username/public_html/index.php controllername methodname

This worked for me.