title: Relative path not working in cron PHP script
body: <p>If a PHP script is run as a cron script, the includes often fail if relative paths are used. For example, if you have</p>
  
  <pre><code>require_once('foo.php');
  </code></pre>
  
  <p>the file foo.php will be found when run on the command line, but not when run from a cron script.</p>
  
  <p>A typical workaround for this is to first chdir to the working directory, or use absolute paths. I would like to know, however, what is different between cron and shell that causes this behavior. Why does it fail when using relative paths in a cron script?</p>