I am using codeigniter 3.1.3 with modular extensions. I have a command for a cron job but it does not seem to work in my cpanel. The cron job is supposed to run every half hour
0,30 * * * * php-cli /home/username/public_html/index.php/module_name controller_name method
2
Answers
First 0,30 is a single parameter, so you need to add one more. Also you’re not calling your Codeigniter function correctly. The standard syntax looks like this:
I left in the ‘module_name’ segment of the of the URL even though I’m not sure too familiar with HMVC, and I’ve seen different structures in what little I have seen, so change the order of those if appropriate.
Use the following command
Get rid of
defined('BASEPATH') OR exit('No direct script access allowed')
in the controller and any model that the controller is loadingYou can read more about running from the command line from the codeigniter documentation
https://www.codeigniter.com/userguide3/general/cli.html