title: file_put_contents failed to open stream: no such file or directory
body: <p>I create a php file that need to create 2 another files via file_put_contents. The problem when I run this code, the lastinsert.txt and newinsert.txt can't be created. I changed the path of these files but I get the same problems. I tried to create the file manually under my web repository it work fine.
  this is my code:</p>
  
  <pre><code>function sendPushNotification($registration_ids, $message) {
  
  $url = 'https://android.googleapis.com/gcm/send';
  $fields = array(
      'registration_ids' =&gt; $registration_ids,
      'data' =&gt; $message,
  );
  
  define('GOOGLE_API_KEY', 'AIzaSyC36gV0pWJgP61mS0JYHadTB66Lz92_1RU');
  
  $headers = array(
      'Authorization:key=' . GOOGLE_API_KEY,
      'Content-Type: application/json'
  );
  echo json_encode($fields);
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
  
  $result = curl_exec($ch);
  if($result === false)
      die('Curl failed ' . curl_error());
  
  curl_close($ch);
  return $result;
  
       }
  
    echo $crc1=(int)file_get_contents('http://mywebsite/public_html/CodeIgniter/lastinsert.txt');
  
       $pushStatus = '';
     $querycount="SELECT id_relation FROM relations ORDER BY id_relation DESC LIMIT 1";
  
       if($query_run= mysqli_query($querycount)){
      while($query_rowcount = mysql_fetch_row($query_run)) {
       $res=print_r($query_rowcount[0]);
  
      file_put_contents("http://mywebsite/public_html/CodeIgniter/lastinsert.txt",$query_rowcount[0]);
  
  
     echo $crc2= (int)file_get_contents('http://mywebsite/public_html/CodeIgniter/lastinsert.txt' );
  
  
     if($crc1!="" &amp;&amp; $query_rowcount[0]&gt;$crc1){
  
  $queryres="SELECT distinct push.title as 'title' from relations join etablissement push on ref_local=push.id where id_relation&gt;".$crc1."";
  if($query_run1= mysqli_query($queryres)){
          $gcmMylocation = array();
  
      while($query_row1 = mysql_fetch_array($query_run1)) {
          $gcmMylocation[]=$query_row1['title'];
  
  
         $result=print_r($query_row1);
  
  foreach ($gcmMylocation as $value) {
  
    echo  $query = "SELECT regId FROM users where company='".$value."'";
  
  if($query_run = mysqli_query($query)) {
  
      $gcmRegIds = array();
      while($query_row = mysql_fetch_assoc($query_run)) {
  
          array_push($gcmRegIds, $query_row['regId']);
          //$res=print_r($query_row);
  
      }
  
  }
  
        etablissement push on ref_relation=push.id join etablissement mypush on ref_local=mypush.id where id_relation&gt;857 and mypush.title='maison' order by ref_local";
  
  
  
  
          echo $query_title="SELECT push.title as 'title' from relations join etablissement push on ref_relation=push.id join etablissement mypush on ref_local=mypush.id where id_relation&gt;".$crc1." and mypush.title='".$value."'";
  
  
  if($query_run_tit= mysqli_query($query_title)){
              while($query_row_tit = mysql_fetch_array($query_run_tit)) {
          $gcmMylocationtit[]=$query_row_tit['title'];
  
  foreach ($gcmMylocationtit as $valuetit) {
  
  $pushMessage=$valuetit;
   if(isset($gcmRegIds)) {
  
      $message = array('m' =&gt; $pushMessage);
      $pushStatus = sendPushNotification($gcmRegIds, $message);
  
  }
   }
       }
       }
          }
        }
      }
       }
        }
       file_put_contents("http://mywebsite/public_html/CodeIgniter/newinsert.txt",$query_rowcount[0]);
  
      }
  </code></pre>