Search code examples
phpbashunzip

Zip fails after PHP download


I am creating a PHP service where a user can download external ZIP files from another server to the server with the PHP. After download I keep getting this ZIP error stating that the file was corrupt / multi-part. That's not the case. I can't extract it on the linux server but when I copy it over to my OSX machine it extracts flawlessly when I double click on the archive but the terminal unzip command gives the same error. I'm confused:

Archive:  pdbeUpload.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.

Here's the link to the file (140MB):

ftp://ftp.ebi.ac.uk/pub/databases/emdb/structures/EMD-2754/map/emd_2754.map.gz

Remember, my aim is to automate the download process, so I need to get to understand why this fails.

Here's what I'm getting with gunzip:

gunzip pdbeUpload.zip 
gzip: pdbeUpload.zip: unknown suffix -- ignored

And for bunzip2, to be complete:

bunzip2: pdbeUpload.zip is not a bzip2 file.

Solution

  • That's a gzip archive, not zip. Use gunzip.