Welcome Guest, Not a member yet? Register   Sign In
No codeigniter cron solutions are working for me!
#1

[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!
#2

[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




Theme © iAndrew 2016 - Forum software by © MyBB