CodeIgniter Forums
No codeigniter cron solutions are working for me! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: No codeigniter cron solutions are working for me! (/showthread.php?tid=34189)



No codeigniter cron solutions are working for me! - El Forum - 09-22-2010

[eluser]Unknown[/eluser]
I have been trying now for weeks, on and off, to get my cron jobs working in codeigniter. I have tried the cron bootstrapper, the CLI.php method, and another method.

None of these seem to work for me and I don't understand why. The closest I get is with the CLI.php method (below)
Code:
if (isset($_SERVER['REMOTE_ADDR'])) {
    die('Command Line Only!');
}

set_time_limit(0);

$_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'] = $argv[1];

$_SERVER['SCRIPT_NAME'] = 'cli.php';

require dirname(__FILE__) . '/index.php';

I added the SCRIPT_NAME line as it was giving me an error that SCRIPT_NAME was undefined. The result I get from running:
Code:
/usr/bin/php5 /home/sites/mysite.co.uk/public_html/cli.php "test/cron"
Is all of the HTML of my homepage, I do not understand why??

If it makes a difference I am with heart internet, I get the error 'Failed to test the script', but when I check the response in firebug it is my homepage HTML.

I have literally tried everything, I have ran google dry with this topic and am completely stuck. I really hope someone can help me as I am going crazy!!

Thanks in advance!


No codeigniter cron solutions are working for me! - El Forum - 09-22-2010

[eluser]Unknown[/eluser]
Ahhh... I don't know why it wasn't working before but it only seems to work when I hard code the controller e.g.
Code:
$_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'] = 'test/cron';
And also when I put it as a command line argument. I have no clue why this is but I'm pretty sure it's all working now.

Thanks