Jump to content

zip file


jagguy

Recommended Posts

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 error

Fatal error: Cannot instantiate non-existent class: ziparchive in C:\www\php\zip1.html on line 3

Does 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();
?>
Link to comment
Share on other sites

Did you install the extension from PECL?

[quote]PHP 4 Bundled

The 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 later

The 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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.