Troubleshooting "zip_read() expects parameter 1 to be resource, integer given"
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2973202/mysql-fetch-array-expects-parameter-1-to-be-resource-boolean-given-in-select">mysql_fetch_array() expects parameter 1 to be resource, boolean given in select</a>  </p>
</blockquote>



<p>I'm stuck with an error concerning the usage of zip_open throwing a consequent error <code>zip_read() expects parameter 1 to be resource, integer given in file</code></p>

<p>The file exists (checked with <code>file_exists()</code>), it could be copied from on directory to another, directories are 777, but zip_open fails (checked with <code>is_resourse()</code>)</p>

<p>This occurred after deplyoing an existing application on a new server. I've checked the ZIP &amp; ZLIB relative configurations and they are identical on both servers.</p>

<p>Any idea why zip_open could fail ?</p>

<p>Code:</p>

<pre><code>$zip = zip_open("/var/www/vhosts/server/web_users/user/archive.ZIP");
if (is_resource($zip))
{
  while ($zip_entry = zip_read($zip))
  {
    $fp = fopen("/var/www/vhosts/website/httpdocs/zip/".zip_entry_name($zip_entry), "w");
    if (zip_entry_open($zip, $zip_entry, "r"))
    {
      $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
      fwrite($fp,"$buf");
      zip_entry_close($zip_entry);
      fclose($fp);
    }
  }

  zip_close($zip);
}
</code></pre>
