Using ZipArchive class


Is there any requirement to use PHP’s ZipArchive class? I mean any extensions to be activated etc.? when I checked my php.ini file, I noticed an extension named as php_zip.dll but it was inactive (commented out). The zip script I used worked but I wanted to make sure it will work on other servers too.


DLL files are for Windows only. From the PHP documentation, assuming you are referring to this [URL=“”]zip functionality, zip must be compiled into PHP on Linux servers. It probably is on most servers. To be sure, you can run phpinfo() and output your particular server’s PHP settings. Look at the output in the zip section. If it lists a Zip section with version information, you have it and don’t need to make any ini entries.


Well, I am working locally on Windows (basic Apache+PHP setup, not IIS) and it works with php_zip.dll file not activated. I checked phpinfo() and it has a Zip section. My hosting is a linux server and it works on it either. The problem is, this is an application that I will distribute, so I need to make sure it will work on all possible setups. Based on your answer, let’s say some servers don’t have Zip enabled, is it possible to make a php.ini entry within my script? Or, should I look for a way to create zip files without using ZipArchive class?

When someone makes a script for distribution (like Wordpress, phpBB, or whatever), they list the requirements necessary to run it. It isn’t possible for them to custom tailor their script to every possible scenario. Zip support is pretty standard, at least on servers running Linux. I wouldn’t even concern myself with it. Most of the time it will be available. As far as making an ini entry to enable zip support, that isn’t going to be possible on a shared server and I believe Zip has to be compiled into PHP on Linux setups.

Thanks for clarification.