How to call CodeIgniter from the CLI or Cron
February 18th, 2009
5 comments
Since CodeIgniter does not accept arguments via the command line, you can not call a specific controller or function.
So you have to do the following to run CI from the CLI or Cron.
Create a second file in the root directory called cronjob.php or whatever and enter these two lines of code:
$_GET["/controller/function"] = null;
require “index.php”;
Make sure to replace “controller” and “function” with your desired controller/function.