Answers.Body: <p>if your user has cron access, you can always create a file, call it cron for simplicity sake, in the file add the command you wish to run, for example mine is a bit interesting cause I have to export my civicrm settings at the same time:</p>
  
  <pre><code>export CIVICRM_SETTINGS="/home/domain/public_html/administrator/components/com_civicrm/civicrm.settings.php"    
  cv api --user=cron job.execute
  </code></pre>
  
  <p>mind you, thats using the CV command, however, this can still be implemented via the cli.php.
  Example:</p>
  
  <pre><code> /path/to/php /path/to/civcrm/bin/cli.php \
    -s example.org \
    -u myusername \
    -p mypassword \
    -e Job \
    -a execute
  </code></pre>
  
  <p>save that in the file you created earlier (with your changes of course), then with cpanels cron, just  set the command/job to execute:</p>
  
  <pre><code>sh cron &gt; /dev/null
  </code></pre>
  
  <p>or </p>
  
  <pre><code>sh cron &gt; /home/domain/logs/cron.log
  </code></pre>
  
  <p>just make sure the file is outside of the web folder and is executable.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-19T03:04:39.450Z
Answers.LastActivityDate: 2018-04-19T03:04:39.450Z
Answers.UserDisplayName: BBuchanan
Body: <p>Need your help....I'm trying to setup cron jobs using the cli.php command given in the documentation....I'm able to run it directly through the terminal...but when I schedule it via cPanel its gives me an error 'cli.php can only be run from command line.'</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-27T15:28:25.760Z
Comments.Text: More information about your setup might help...
Comments.UserDisplayName: Eric Booth
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-19T16:23:10.323Z
Comments.Text: @guru316 if you provide more info on your setup - I can provide CPanel instructions.  I would need to know what version of Civi and what CMS.
Comments.UserDisplayName: themak
Tags: <cron><cli>
Title: Setting up cron jobs on cPanel
ThreadText: # Setting up cron jobs on cPanel
  
  (Asked by: username_0 on 2017-09-26)
  
  Need your help....I'm trying to setup cron jobs using the cli.php command given in the documentation....I'm able to run it directly through the terminal...but when I schedule it via cPanel its gives me an error 'cli.php can only be run from command line.'
  
  **Tags:** cron, cli
  
  > **Comments:**
  > **username_1**: More information about your setup might help...  
  > **username_2**: @guru316 if you provide more info on your setup - I can provide CPanel instructions.  I would need to know what version of Civi and what CMS.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2018-04-19. Score: 1
  
  if your user has cron access, you can always create a file, call it cron for simplicity sake, in the file add the command you wish to run, for example mine is a bit interesting cause I have to export my civicrm settings at the same time:
  export CIVICRM_SETTINGS="/home/domain/public_html/administrator/components/com_civicrm/civicrm.settings.php"    
  cv api --user=cron job.execute
  
  mind you, thats using the CV command, however, this can still be implemented via the cli.php.
  Example:
   /path/to/php /path/to/civcrm/bin/cli.php \
    -s example.org \
    -u myusername \
    -p mypassword \
    -e Job \
    -a execute
  
  save that in the file you created earlier (with your changes of course), then with cpanels cron, just  set the command/job to execute:
  sh cron > /dev/null
  
  or 
  sh cron > /home/domain/logs/cron.log
  
  just make sure the file is outside of the web folder and is executable.
  
  
  ---
  
  