title: Codeigniter 3 CRON via CLI not working
body: <p>I'm trying to set up a cron to run a codeigniter controller/method.</p>
  
  <p>I have my application and system file etc outside of the root.</p>
  
  <p>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:</p>
  
  <pre><code>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';
  </code></pre>
  
  <p>Now, I can successfully run the controller/method via cli using this termical command:</p>
  
  <pre><code>php cli.php cron/reccuring_checks
  </code></pre>
  
  <p>But can I get it to run as a cron?? oh dear NO i cannot, been at this for a whole day.</p>
  
  <p>I've tried: (as well as 1000 different other combinations)</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I get the following error</p>
  
  <pre><code>&lt;p&gt;Severity: Notice&lt;/p&gt;
  &lt;p&gt;Message:  Undefined index: REMOTE_ADDR&lt;/p&gt;
  &lt;p&gt;Filename: drivers/Session_files_driver.php&lt;/p&gt;
  &lt;p&gt;Line Number: 130&lt;/p&gt;
  </code></pre>
  
  <p>And a lot of the posts I can find online about this generally relate to CI2 and the method of replacing:</p>
  
  <pre><code>$_SERVER['REMOTE_ADDR'] with $this-&gt;server('remote_addr')
  </code></pre>
  
  <p>In the system/core/input file, but that is already amended in CI3</p>
  
  <p>So has anyone got a clue how I can get this to work?</p>
  
  <p>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?</p>