PHP下载后Zip失败

时间:2015-02-10 21:54:40

标签: php bash unzip

我正在创建一个PHP服务,用户可以使用PHP将外部ZIP文件从另一台服务器下载到服务器。下载后,我不断收到此ZIP错误,指出该文件已损坏/多部分。事实并非如此。我无法在linux服务器上提取它,但是当我将其复制到我的OSX机器上时,当我双击存档但是终端unzip命令给出相同的错误时,它会完美地提取。我很困惑:

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.

这是指向该文件的链接(140MB):

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

请记住,我的目标是自动化下载过程,因此我需要了解失败的原因。

这是我用gunzip得到的东西:

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

对于bunzip2,要完成:

bunzip2: pdbeUpload.zip is not a bzip2 file.

1 个答案:

答案 0 :(得分:4)

这是一个gzip存档,而不是zip。使用gunzip