title: PHP - CLI vs cronjob - same script, different results
body: <p>I have a PHP script that runs perfectly fine on the command line if I simply run it like this <code>php /path/to/script/script.php</code>.
  if I now schedule this very command in cron using <code>crontab -e</code> and the add the line:</p>
  
  <pre><code>*/1 * * * * php /path/to/script/script.php 2&gt;&amp;1 &gt;&gt; /var/log/logfile.log
  </code></pre>
  
  <p>it does get executed every minute as expected and all the output gets put into the log file just like running it on the command line. But the some parts of the script just don't seemt o work. those particular parts are lines that are like:</p>
  
  <pre><code>system('mkdir /mnt/temp', $retVal);
  </code></pre>
  
  <p>or</p>
  
  <pre><code>exec('mkdir /mnt/temp');
  </code></pre>
  
  <p>I have tried every possible thing like running it as root, permissions on all scripts and folders that would be affected, using <code>/bin/mkdir</code> instead of <code>mkdir</code>. The return value from the system() is 0 for running it on CLI and 1 for the crontab way.</p>
  
  <p>Any suggestions?</p>