tags:

views:

355

answers:

2

Is there any way to unpack or extract a zip file with PHP that does not rely on any installed extension? Has anyone written a class or something that can handle it?

Alternatively, is there a solution that uses an extension that is relatively commonly installed on most servers?

I need this to work on as many different servers that I have no control over as possible.

Thanks for any help!

A: 

Well, it looks like most of them require php.ini settings, which you may be able to override in your script:

http://www.w3schools.com/php/php%5Fref%5Fzip.asp

http://devzone.zend.com/article/2105

and here is how to edit the php.ini file without direct access: http://www.whenpenguinsattack.com/2006/01/20/how-to-override-phpini/

Cryophallion
A: 

Check this lib it helps to solve same problem

require_once('pclzip.lib.php');

$archive = new PclZip(dirname(__FILE__).'/Archive.zip');

if ($archive->extract(PCLZIP_OPT_PATH, dirname(__FILE__).'/extract') == 0) {
    echo "\n error while extract";
} else {
    echo "\n extract ok";
}
duganets