Opening and creating password protected zip files with PHP Opening and creating password protected zip files with PHP php php

Opening and creating password protected zip files with PHP


It was not possible do do below PHP5.6.0. But in a new PHP5.6.x version developers added this functionality. So no need for a scary system or shell_exec (which can lead to security vulnerability).

So right now you can do something like this:

ZipArchive::setPassword($password)


You can create simple file zip using some libraries (as PclZip) but you can't create zip with the password.


No, PHP's ZIP library has no support for passwords. You might look for another ZIP library that supports it and has PHP language bindings.

I don't know any from the top of my head that supports it for creating and opening.