Setting up a cron job using codeigniter
I have a function that I want to execute via cron. If I just remove the urlwww.example.com/TestProjects/codeigniter/controller/function
This function works fine, if I set it to cron doesn't work.
I tried to set this like
public_html/TestProjects/codeigniter/controller/function
and this is through this error message
public_html/TestProjects/codeigniter/controller/function: Not a directory
Can anyone help me set this on cron?
+3
source to share
4 answers
First try running this controller method in CLI mode. In the console, navigate to your project directory and then run your script in CLI mode:
cd TestProjests/codeigniter
php index.php controller function
If that works, paste the same line into the crontab, but with an absolute path:
php /path_to_your_projects/TestProjests/codeigniter/index.php controller function
This might help you too: https://ellislab.com/codeigniter/user-guide/general/cli.html
+2
source to share