I'm trying to set up a cron to run a codeigniter controller/method.
I have my application and system file etc outside of the root.
I have created a cli.php file as a hack to get it working, as suggested by someone on the codeigniter forums. the content of the file are:
if (isset($_SERVER['REMOTE_ADDR'])) {
die('Command Line Only!');
}
set_time_limit(0);
$_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'] = $argv[1];
require dirname(__FILE__) . '/public_html/index.php';
Now, I can successfully run the controller/method via cli using this termical command:
php cli.php cron/reccuring_checks
But can I get it to run as a cron?? oh dear NO i cannot, been at this for a whole day.
I've tried: (as well as 1000 different other combinations)
php cli.php cron reccuring_checks
/usr/bin/php -q /home/DOMAIN/cli.php cron/reccuring_checks
/usr/bin/php -q /home/DOMAIN/cli.php cron reccuring_checks
I get the following error
<p>Severity: Notice</p>
<p>Message: Undefined index: REMOTE_ADDR</p>
<p>Filename: drivers/Session_files_driver.php</p>
<p>Line Number: 130</p>
And a lot of the posts I can find online about this generally relate to CI2 and the method of replacing:
$_SERVER['REMOTE_ADDR'] with $this->server('remote_addr')
In the system/core/input file, but that is already amended in CI3
So has anyone got a clue how I can get this to work?
I assume the issue is that I have the core files above root, but thats what CI suggest you do for security, and I'm way to far down the line to change it now?