jagguy Posted November 21, 2006 Share Posted November 21, 2006 q) to install zip on php with winxp, I uncomment the php.ini and goto the extension=php_zip.dll and restart apache.The I run the this to test it and it fails with errorFatal error: Cannot instantiate non-existent class: ziparchive in C:\www\php\zip1.html on line 3Does this mean it is not installed? I did the same process with GD and it worked for that.<?php$zip = new ZipArchive();$filename = "./test112.zip";if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {exit("cannot open <$filename>\n");}$zip->addFromString("testfilephp.txt" . time(), "#1 This is a test string added as testfilephp.txt.\n");$zip->addFromString("testfilephp2.txt" . time(), "#2 This is a test string added as testfilephp2.txt.\n");$zip->addFile($thisdir . "/too.php","/testfromfile.php");echo "numfiles: " . $zip->numFiles . "\n";echo "status:" . $zip->status . "\n";$zip->close();?> Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted November 21, 2006 Share Posted November 21, 2006 Did you install the extension from PECL?[quote]PHP 4 BundledThe initial version is bundled in PHP 4 and is available in PECL as version 1.0, see http://pecl.php.net/package/zip. It can only read Zip Archives.This version uses the functions of the ZZIPlib library by Guido Draheim. You need ZZIPlib version >= 0.10.6.PECL and PHP 5.2 or laterThe newest version is bundled in PHP 5.2.0 or later and available in PECL, as version 1.1.0 or later. It does not require any external library. It can read and write Zip archives when used with PHP 5.1 or later and can only read them when used with PHP4. [/quote] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.