Monday, February 21, 2011

Is there a way to create an uncompressed zip from PHP?

Is there a way to create an uncompressed ZIP (level 0) from PHP? I can't find any info in the php documentation.

From stackoverflow
  • You can use exec() to run any command on the server, in which case it will depend on the environment (Linux, windows, etc.)

  • If the zip tool is installed on your server, you can always use the shell_exec() function to execute an external command. That way you can most likely create an uncompressed zip file.

  • According to php.net’s bugtracker (and bug #41243) this functionality is not available in the built-in zip utilities. For now you have to shell out.

  • Thank you, guys!

    I found a solution using pear's late Archive_Zip library. There's a bug in it causing corrupted files when using no_compression parameter. The solution found at http://pear.php.net/bugs/bug.php?id=7871 solved that problem!

0 comments:

Post a Comment