cronjob in codeigniter using cpanel

You can use wget and set the time for whatever you like:

wget http://www.mysite.com/admin/sendDailyEmail

You can also use curl:

curl --silent http://www.mysite.com/admin/sendDailyEmail

For CodeIgniter 2.2.0

You can try this:

 php-cli /home/username/public_html/index.php controller method

or at your case

 php-cli /home/username/public_html/index.php admin sendDailyEmail 

It works fine with me.. Cheers!


Codeigniter sets up command line differently for running crons, etc.

Read: http://www.codeigniter.com/user_guide/general/cli.html

So you should run:

php index.php admin admin sendDailyEmail

(that may need adjusted; based on your code above)

Have a look at an article I just wrote that goes a little deeper into it all:

http://codebyjeff.com/blog/2013/10/setting-environment-vars-for-codeigniter-commandline