Welcome Guest, Not a member yet? Register   Sign In
How to run CodeIgniter cron jobs with subdirectory?
#1

I need assistance setting up cron jobs on a CodeIgniter site hosted on cPanel's shared hosting. While the cron script runs successfully when accessed through a browser, I have encountered difficulties running it via cron using both curl and wget. Eventually, I aim to execute the jobs using php/cli.

I'm uncertain why the curl and wget methods fail. Could this be related to the site's SSL configuration, where all HTTP requests are rewritten to HTTPS using the .htaccess file? It's worth mentioning that I haven't completely ruled out the possibility of the host disabling cron for unknown reasons.

Update: I have confirmed with the host that cron is functioning properly.

I came across an article discussing cron and CI CLI, which provides the following example:


/usr/local/bin/php -f /home/clinic/public_html/index.php cron foo
However, my controller is located within a subdirectory, such as /controllers/utility/cron.php, and I have configured CodeIgniter to exclude index.php from the URL structure. In this case, how can I run the cron job?

I would greatly appreciate guidance on running the cron job considering the subdirectory structure and CodeIgniter's URL configuration.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB