title: CodeIgniter Cron Job through Cpanel
body: <p>Ok I looked at every other thread and have done exactly what they've done and what it says in the manual and I can NOT figure this out for the life of me.
  The results of the cron job are being emailed to one of my emails. ALL it is doing is printing out the html markup of the layout... And printing the base page content... It's like it's not registering anything.</p>
  
  <pre><code>php /home/jdstable/public_html/dev/index.php cron decrease_pets_stats
  </code></pre>
  
  <p>That's my command line.. I tried replacing php with the user/local/bin/php thing as well and it didn't work. The thing is is that I have other cron jobs running off procedural PHP code that work FINE with php path/to/cron.php... But it won't work with CI..</p>
  
  <p>My controller is Cron and my method is decrease_pets_stats..</p>
  
  <pre><code>//decrease pets stats
  public function decrease_pets_stats() {
  $this-&gt;load-&gt;model('Cron_model', 'cron');
      $this-&gt;cron-&gt;decrease_pets_stats();
      echo 'Decreased pet stats';
  }
  </code></pre>
  
  <p>And here is the logic of the method:</p>
  
  <pre><code>//decrease pets stats
  //runs every hour
  public function decrease_pets_stats() {
      $this-&gt;db-&gt;set('hunger', 'hunger - 5');
      $this-&gt;db-&gt;set('happiness', 'happiness - 5');
      $this-&gt;db-&gt;set('loyalty', 'loyalty - 5');
      $this-&gt;db-&gt;update('user_creature');
  }
  </code></pre>
  
  <p>Does anyone have any idea why it's just printing the layout markup? My constructor looks like this:</p>
  
  <pre><code>public function __construct() {
          parent::__construct();
          if( ! $this-&gt;input-&gt;is_cli_request()) show_error('Direct access is not allowed');
  
          $this-&gt;load-&gt;model('Cron_model', 'cron');
      }
  </code></pre>
  
  <p>And my parent constructor holds quite a bit of stuff (loading helpers and libraries along with getting the user information to appear on each page if they are logged in.</p>
  
  <p>Does it matter if this is at the top of the controller before even opening the controller Cron class?</p>
  
  <pre><code>if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  </code></pre>