title: How to write a auto executable script in php?
body: <p><strong>From the basic of php i know that php needs to have some action/request to execute</strong> so i am little confused about how to do it. I know it can be done but don't know how.</p>
  
  <p>I want to write a php script which will run in server every 6 hours and update the database info from an api.</p>
  
  <p><strong>More Info:</strong></p>
  
  <p>The server i am currently working is in linux. But i want to know how i can do it in both linux and windows.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Cron does not find my script. I don't know where is the problem is. I have used this command in my cpanel</p>
  
  <p><code>0 */6 * * * php public_html/path_to_dir/file_to_run.php</code></p>
  
  <p>I have setup the cron so cPanel send me email. The email i am getting is showing some error.</p>
  
  <p><code>/bin/sh: 0: command not found</code></p>
  
  <p>Looking forward to your help.</p>