title: php file_get_contents(): content truncated from 2147483648 to 2147483647 bytes
body: <p>How can I find out the issue when I'm going to create zip file of 2GB file.</p>
  
  <p><strong>Error</strong> </p>
  
  <blockquote>
    <p>file_get_contents(): content truncated from 2147483648 to 2147483647
    bytes</p>
    
    <p>Fatal error: Out of memory (allocated 2151677952) (tried to allocate
    18446744071562067968 bytes) in</p>
  </blockquote>
  
  <p>I am using dedicated server and already set <code>memory_limit,max_execution_time,max_upload_filesize,max_post_size</code>. But it is not working for me.Please check my code and let me know what i am doing wrong -</p>
  
  <h1>create new zip object</h1>
  
  <pre><code>    $zip = new ZipArchive();
  
      # create a temp file &amp; open it
      $tmp_file = tempnam('.','');
      $zip-&gt;open($tmp_file, ZipArchive::CREATE);
  
      # loop through each file
      foreach($files as $file){
          # download file
          $download_file = file_get_contents($file_path.'/'.$file);
          #add it to the zip
          $zip-&gt;addFromString(basename($file_path.'/'.$file),$download_file);
      }
  
      # close zip
      $zip-&gt;close();
      $zip_name = $last_seg.'.zip';
      # send the file to the browser as a download
      header("Content-disposition: attachment; filename=$zip_name");
      header('Content-type: application/zip');
      readfile($tmp_file);
  </code></pre>