通过PHP下载期间损坏的ZIP文件 [英] Corrupted ZIP files during download via PHP

查看:55
本文介绍了通过PHP下载期间损坏的ZIP文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我在这里发布了这个相当冗长的描述,希望能够获得最后的一些问题,这对于一个真正伤害我业务的问题有所帮助,

因为我得出的结论是我的问题至少部分是与b $ PHP相关的。


现在一段时间了我一直有转移问题,即我的客户

大型二进制(ZIP)文件的下载通常是损坏的。


一个损坏的文件现在然后可以当然永远不会避免,但我每天都会收到客户的几个投诉。在任何特定文件中,

约。 4个下载中的1个(大于100kB左右)受到影响。

我花了几个月的时间试图找到问题的根源而没有成功获得
,但我一直在能够排除许多可能的原因。这是

一些事实:


1)服务器上的实际文件是正常的。直接(未加密)链接很好,所以这不是一般问题。


2)大约50%的客户下载(确切地说)相同的文件)来自

另一个来源。我不会每两个月从那些

的客户那里得到1个投诉,而我每天从我的服务器上下载那些

的人会得到1-3个投诉。 br />

3)客户有各种软件/硬件/操作系统,所以它不太可能是用户问题。另外,同一个客户经常从这两个地方下载,

但是我的服务器上的文件只有问题。


4)我关闭了所有脚本有一段时间,所以只剩下一个静态的
网站,但它没有帮助。


5)我在三台服务器上遇到过这个问题:目前的RaQ550,之前的RaQ4和之前的RaQ4以及之前的RaQ4。因此,它与服务器相关的可能性非常小。




6)我可以自己轻松地重现问题。当我调查这个时,我发现了一个系统错误:


用二进制/十六进制编辑器分析腐败与干净的ZIP文件下载

清楚地表明错误是系统性的。干净的ZIP文件有很多

的00h字节。在所有损坏的ZIP文件中所有(好的,大多数)
这些字节的
已被换成''5C30h'',即两个字节(00h - >

5C30h)!


由于''5C30h''等于逃逸的零,即\ 0,我的猜测是

是翻译某处出错。


那么,PHP与此有什么关系呢?好吧,我的下载链接到

购买软件由PHPewportal加密:
http://www.eliteweaver.co.uk/antifra....php?page=Home

从我能够发现的一些事实来看,似乎有一些

有时会出现损坏的ZIP文件的问题,具体取决于ZLIB的

设置/编译。如果这个论坛上的任何人都经历了类似的事情,我会非常感激他们是否可以分享。

我的服务器PHP配置位于:
http://www.snith.com/phptest.php

祝你好运,Lars

解决方案

***瑞典人escribió/写道(星期二,2005年2月15日21:16:18 +0100 ):

现在有一段时间我一直有传输问题,即我的客户下载大型二进制(ZIP)文件经常损坏。


我建议您查看服务器的* .zip文件的MIME类型。


从我能够做到的一些事实发现它似乎有时会出现RR文件损坏的问题,具体取决于ZLIB的设置/编译。




你压缩了吗?飞行中的文件?

-

- +álvaroG。Vicario - 西班牙布尔戈斯

+ - http://www.demogracia.com (la web de humor barnizada para la intemperie)

++ Manda tus dudas al grupo,no amibuzón

- +发送你的问题到小组,而不是我的邮箱

-


你好Alvaro,


Alvaro G. Vicario写道:

***瑞典人escribió/写(星期二) ,2005年2月15日21:16:18 +0100):

现在有一段时间我一直有转移问题,即我的客户下载大型二进制(ZIP)文件通常是损坏的。



我建议您检查服务器的MIME类型* .zip文件。




我已经尝试过,它被设置为一些非描述性的应用程序。

我把它改成了octet-stream。与* .exe一起使用和另一个

二进制文件,但它没有帮助。除了mime.types之外还有其他地方吗?

哪里可以改变这个?


我看过一些关于评论的简短评论标题是

获取class.download.inc中文件的mimetype,但我不知道

如何/在哪里做,如果它与我的问题。

从我能够发现的一些事实来看,似乎有时存在损坏的ZIP文件的问题,具体取决于
设置/编译ZLIB。



你是否动态压缩文件?




不是故意的...它们已经是服务器磁盘上的ZIP。


感谢您的输入到目前为止,我认为您肯定是在正确的

路径!还有更好的想法吗?

祝你好运,Lars


***瑞典人escribió/写道(星期二,2005年2月15日21:52:39 +0100):

我已经尝试过,它被设置为一些非描述性的应用程序。
我把它改成了octet-stream。与* .exe一起使用和其他的二进制文件,但它没有帮助。除了mime.types之外还有更多地方吗?
我可以改变这个地方吗?




我的建议只是因为服务器可能正在使用默认值输入

(通常是text / html)并且正在搞乱字符编码或者天知道

什么。


无论如何,既然你似乎是使用PHP脚本来提供文件,然后它是那个应该设置MIME类型的脚本的b / b
;否则你将获得默认类型
。类似的东西应该做:


header(''Content-Type:application / zip'');


Internet Explorer已知因为PDF文件有问题(特别是如果你用
使用会话)但是我不确定ZIP。


-

- +álvaroG。Vicario - 西班牙布尔戈斯

+ - http://www.demogracia.com (la web de humor barnizada para la intemperie)

++ Manda tus dudas al grupo,no amibzón

- +将您的问题发送给小组,而不是发送到我的邮箱

-


Hello,

I am posting this rather lengthy description here in hope of getting at
least some insight into a problem that is really hurting my business,
since I have come to the conclusion that my problem is at least partly
PHP-related.

Some time now I have been having transfer problems, i.e. my customers
downloads of large binary (ZIP) files are often corrupt.

A corrupted file now and then can of course never be avoided, but I get
several complaints from customers every day. Of any specific file,
approx. 1 out of 4 downloads (larger than 100kB or so) are affected.
I have spent months trying to find the source of the problems without
success, but I have been able to rule out many possible causes. Here are
some facts:

1) The actual files are OK on the server. Direct (unencrypted) links are
fine, so it''s not a general problem.

2) About 50% of the customers download (the exact same files) from
another source. I don''t even get 1 complaint every two months from those
customers, while I get 1-3 complaints _every day_ from those who
download from my server.

3) The customers have various SW/HW/OS, so it''s very unlikely that it''s
a user problem. Plus, the same customer often download from both places,
but only have problems with the files from my server.

4) I have shut down all scripts for a while, so that only a static
website remained, but it didn''t help.

5) I have had this problem on three servers: The present RaQ550, the
previous RaQ4 and the RaQ4 I had before that. So it''s highly unlikely
that it is server-related.

6) I can easily reproduce the problem myself. As I looked into this I
found a systematic error:

Analyzing corrupt vs. clean ZIP file downloads with a binary/hex editor
clearly shows that the error is systematic. Clean ZIP files have a lot
of ''00h'' bytes in them. In ALL of the corrupt ZIP files ALL (well, most)
of these bytes have been exchanged for ''5C30h'', i.e. TWO bytes ( 00h ->
5C30h ) !

Since ''5C30h'' equals an escaped zero, i.e. "\0", my guess is that there
is a translation error somewhere.

So, what does PHP have to do with this? Well, my download links to
purchaseware are encrypted by the PHP "ewportal":
http://www.eliteweaver.co.uk/antifra....php?page=Home

From the few facts I have been able to uncover it seems there is
sometimes a problem with corrupted ZIP files depending on the
setting/compilation of ZLIB. If anyone on this forum have experienced
similar things I would very much appreciate if they could share.
My servers PHP configuration is at:
http://www.snith.com/phptest.php

Best regards, Lars

解决方案

*** Swede escribió/wrote (Tue, 15 Feb 2005 21:16:18 +0100):

Some time now I have been having transfer problems, i.e. my customers
downloads of large binary (ZIP) files are often corrupt.
I suggest that you check the server''s MIME type for *.zip files.

From the few facts I have been able to uncover it seems there is
sometimes a problem with corrupted ZIP files depending on the
setting/compilation of ZLIB.



Do you compress the files on the fly?
--
-+ álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Manda tus dudas al grupo, no a mi buzón
-+ Send your questions to the group, not to my mailbox
--


Hello Alvaro,

Alvaro G. Vicario wrote:

*** Swede escribió/wrote (Tue, 15 Feb 2005 21:16:18 +0100):

Some time now I have been having transfer problems, i.e. my customers
downloads of large binary (ZIP) files are often corrupt.



I suggest that you check the server''s MIME type for *.zip files.



I have already tried that, it was set to some non-descript application.
I changed it to "octet-stream" together with "*.exe" and the other
binaries, but it did not help. Is there any more place than "mime.types"
where I could change this?

I have seen some brief comments about "commenting out the header which
gets the mimetype of the file in class.download.inc", but I have no idea
how/where to do that, and if it is related to my problem.

From the few facts I have been able to uncover it seems there is
sometimes a problem with corrupted ZIP files depending on the
setting/compilation of ZLIB.



Do you compress the files on the fly?



Not intentionally...they are already ZIPs on the server disk.

Thanks for your input so far, I think you are definitely on the right
path! Any more good ideas?
Best regards, Lars


*** Swede escribió/wrote (Tue, 15 Feb 2005 21:52:39 +0100):

I have already tried that, it was set to some non-descript application.
I changed it to "octet-stream" together with "*.exe" and the other
binaries, but it did not help. Is there any more place than "mime.types"
where I could change this?



My suggestion only came because maybe the server was using the default type
(usually text/html) and was messing with character encoding or God knows
what.

Anyway, since you seem to be using a PHP script to serve files then it''s
the script the one who should be setting the MIME type; otherwise you''ll
get the default type. Something similar to this should do:

header(''Content-Type: application/zip'');

Internet Explorer is known for having problems with PDF files (esp. if you
use sessions) but I''m not sure about ZIPs.

--
-+ álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Manda tus dudas al grupo, no a mi buzón
-+ Send your questions to the group, not to my mailbox
--


这篇关于通过PHP下载期间损坏的ZIP文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆