title: file_put_contents failed to open stream: no such file or directory (only locally)
body: <p>I have a PHP script that I've added to a cron job, although the PHP script is not able to be ran locally.</p>
  
  <p>If I access it through the web browser, it works 100%. If I access it through terminal, it reproduces the behavior below.</p>
  
  <p><strong>Test:</strong></p>
  
  <pre><code>$ php5 /path/test.php
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>file_put_contents(folder/filename.txt): failed to open stream: No such file or directory in /path/test.php on line 11
  </code></pre>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>$host = 'https://www.google.com/';
  $ch = curl_init();
  curl_setopt($ch,CURLOPT_URL,$host);
  curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,1);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  $result = curl_exec($ch);
  $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  curl_close($ch);
  
  file_put_contents('folder/filename.txt', $status);
  </code></pre>
  
  <p>I don't believe permissions are an issue since the error doesn't state anything, but the <code>folder</code> is set to 777 and the php script is set to +w through chmod</p>
  
  <p>Any help would be appreciated, this is all new to me.</p>
  
  <p><strong>Folder Structure:</strong></p>
  
  <pre><code>/path/test.php
  /path/folder/filename.txt
  </code></pre>