title: cronjob in codeigniter using cpanel
body: <p>My website hosting server is hostmonster.com.</p>
  
  <p>My application uses codeigniter framework.</p>
  
  <p>I have a code which sends emails to my users and I want to make it automatic.</p>
  
  <p>I have used the cpanel of the hosting service and I tried to give the command as</p>
  
  <pre><code>php -q www.mysite.com/admin admin sendDailyEmail
  </code></pre>
  
  <p>my controller is admin and the method is sendDailyEmail and the controller is present inside the application/controllers/admin folder.</p>
  
  <p>I have also set a reminder email to me whenever the cronjob is run.</p>
  
  <p>The email subject reads </p>
  
  <blockquote>
    <p>Cron  php -q /home1/username/public_html/admin admin sendDailyEmail</p>
  </blockquote>
  
  <p>and the body says</p>
  
  <blockquote>
    <p>No input file specified</p>
  </blockquote>
  
  <p>Where do I go wrong.</p>
  
  <p>I have never run cronjobs and this is my first time.
  I am no good in giving command line instuctions too.</p>
  
  <p>My admin sendDailyEmail code is as follows</p>
  
  <pre><code>function sendDailyEmail() {
      $data = $this-&gt;admin_model-&gt;getDailyData();
      foreach ($data as $u) {
      if($u-&gt;Daily){
       //if(!$u-&gt;Amount){
         if ($u-&gt;Email=='myemail@gmail.com') {
  
                  $user['user_data']['FirstName'] = $u-&gt;FirstName;
                  $user['user_data']['LastName'] = $u-&gt;LastName;
                  $user['user_data']['Id']=$u-&gt;Id;
  
                  $this-&gt;email-&gt;clear();
                  $this-&gt;email-&gt;to($u-&gt;Email);
                  $this-&gt;email-&gt;from('alerts@mysite.com', 'MySite');
                  $this-&gt;email-&gt;subject("My Subject");
                  $msg = $this-&gt;load-&gt;view('emails/daily_view', $user, true);
                  $this-&gt;email-&gt;message($msg);
                  if ($this-&gt;email-&gt;send())
                      $data['message'] = "Daily Emails has been sent successfully";
                  else
                      $data['message'] = "Daily Emails Sending Failed";
              }
          }
      }
      $data['main_content']['next_view'] = 'admin_home_view';
      $this-&gt;load-&gt;view('includes/admin_template', $data);
  }
  </code></pre>