|  | 
  Priyam Chokhani - 2016-05-19 11:24:06When trying to add a large file to a zip I get the following error- 
 PHP Warning:  unpack(): Type V: not enough input, need 4, have 0 in Zip.php on line 454
 
 PHP Warning:  unpack(): Type V: not enough input, need 4, have 0 in Zip.php on line 456
 
 This happens on only one of my machines. It works fine on other machines. The code is as follows -
 
 $zip->addLargeFile($fileLocation,getFileName("abc"));
  Asbjorn Grandt - 2016-05-19 11:42:55 - In reply to message 1 from Priyam ChokhaniWhat are the php versions and machine architecture (cpu &32/64 bit) on those machines. It sounds like a problem specific to either the PHP version, and/or the machine architecture.
  Priyam Chokhani - 2016-05-19 12:32:55 - In reply to message 2 from Asbjorn GrandtThe machine details are as follows - 
 Microsoft Windows Server 2012 Standard (x64- based processor)
 PHP version - 5.6.0
 
 The application is hosted on IIS.
  Asbjorn Grandt - 2016-05-19 13:07:21 - In reply to message 3 from Priyam ChokhaniSo, similar hardware an setup, but different results. 
 How large is the file you are trying to add? Zip in its current form does not support Zip64, meaning 4GB is the max, but due to bugs/design errors in PHP I think it might be limited to 2GB files.
  Priyam Chokhani - 2016-05-19 15:28:45 - In reply to message 4 from Asbjorn GrandtThe file size is around 5 MB. If I try adding small file (in KB's) using addFile, it works fine.
  Asbjorn Grandt - 2016-05-19 16:30:35 - In reply to message 5 from Priyam ChokhaniThe file should not fail. It really shouldn't. That version of Zip is getting quite old though, and it has been merged with the ZipStream package, which has been updated.
 That said, it wouldn't matter really, as that part of the code is pretty much the same. For some reason the file handle of the temporarily zipped data is running out of data, something that shouldn't happen even if $fileLocation,getFileName("abc") returns something wrong.
 
 Please check that $fileLocation,getFileName("abc") returns a valid file path, and that Zip is allowed to actually read it.
 
 is_readable($fileLocation,getFileName("abc")) should return true if it's ok.
 
 
  Priyam Chokhani - 2016-05-20 08:32:39 - In reply to message 6 from Asbjorn Grandtis_readable($fileLocation) gives true however the mentioned is_readable($fileLocation,getFileName("abc")) returns false as is_readable expects only 1 param. 
 
 Some more details - IIS 8 is being used, fast_cgi impersonation is enabled. We have given rights to IUSR which would be used for impersonation.
  Asbjorn Grandt - 2016-05-20 10:36:55 - In reply to message 7 from Priyam ChokhaniAh, I missed the comma, it looked like a dot. Sorry.
 I'm trying to figure out what different is between the machines, you mentioned one worked, while the other didn't.
  Priyam Chokhani - 2016-05-20 11:06:23 - In reply to message 8 from Asbjorn GrandtThe machine on which it worked did not have fast_cgi impersonation enabled. I could only see this as a difference.  |