Are there any PHP-scripts out there that can unzip regular zip-files? The requirements we have is that we must run with safe_mode on and we're not allowed to install any extensions to enable this functionality. Thus, any functionality must be regular php scripts.
Any thoughts?
EDIT: Unfortunately, neither of the posted solution works for us. We may not change the safe_mode requirement unless switching hosts, which is currently not an option.
pclzip.lib.php is a fairly popular and well used php class that is able to extract zip file susing pure php
The usual answer here is this or this. However, according to the PHP documentation:
PHP 4
The bundled PHP 4 version requires » ZZIPlib, by Guido Draheim, version 0.10.6 or later
PHP 5.2.0 or later
This extension uses the functions of » zlib by Jean-loup Gailly and Mark Adler.
So, both need external dependencies.
Can't you ask them to disable safe mode for a single folder using a .htaccess directive such as:
php_value safe_mode "0"
and put the unzip script in there?
If so, then something like:
$output = shell_exec('unzip /path/to/file');
Would do it
Have a look at http://www.phpclasses.org/browse/package/2495.html
It uses the gzip extension but that's installed on almost every server (I hope, check with phpinfo() )
If you are running on linux/unix you can run
exec("unzip file.zip");
Note: When safe mode is enabled, you can only execute files within the
safe_mode_exec_dir.