Search code examples
phpcodeignitercroncodeigniter-3cpanel

Setting up cronjob in cpanel using codeigniter php not working


i have a page in my website where i have a script in my view page mysite.com/feepayment/homecontroller/mystatus, whenever we visit the link, the script runs, now i want to add it to cronjob in cpanel, the cronjob in cpanel was showing an example like this: PHP command examples: General example: /usr/local/bin/php /home/mnyfxhioxjmc/public_html/path/to/cron/script

so i set the time setting to twice in 1 hour and in command box i gave: /usr/local/bin/php /home/mnyfxhioxjmc/public_html/feepayment/application/views/mystatus.php

but this doesnt seem to work, its giving me error in my mail like below:

Could not open input file: /home/mnyfxhioxjmc/public_html/feepayment/application/views/mystatus.php

can anyone please tel me whats wrong in here, thanks in advance


Solution

  • in codeigniter you should call the function using the application index followed by the controller and the function name. Ref: Running via the CLI

    In your case if you have a Mystatus controller with the status function:

    /usr/local/bin/php /home/mnyfxhioxjmc/public_html/feepayment/index.php mystatus status