Hello everyone,

I'm trying to expiriment with the ZipArchive functions and I keep getting this error

Fatal error: Class 'ZipArchive' not found

I've installed the DLL and my phpINFO page shows that zip is enabled.

on phpinfo:
ZLib Support enabled

Stream Wrapper support compress.zlib://

Stream Filter support zlib.inflate, zlib.deflate

Compiled Version 1.2.3

Linked Version 1.2.3

any ideas?

thanks all,
eff

    Windows

    Windows users need to enable php_zip.dll inside of php.ini in order to use these functions.

    assuming that you've done that and rebooted your server id say we need to know:

    1) what version of PHP you are running

    2) what your code looks like that is trying to use the functions

      sry..

      PHP Version 5.2.6

      Microsoft-IIS/5.1

      Windows XP PRO


      code:

      <?php 
      ////////////////////////////////////
      //* TESTING ZIP ARCHIVING IN PHP *//
      ////////////////////////////////////
      
      //CREATE ZIP OPJECT
      $zip = new ZipArchive();
      
      //OPEN AN ARCHIVE
      if($zip->open('ziptest.zip') !==TRUE) 
      {
      	die ("Could not open archive!");
      }
      else
      {
      	echo("OPENED ARCHIVE!");
      }
      
      // GET NUM FILE IN ARCHIVE
      $numfiles = $zip->numFiles;
      
      //ITERATE OVER FILE LIST
      //PRINT DETAILS OF EACH FILE
      for($x=0;$x<$numFiles;$x++)
      {
      	$file = $zip->statIndex($x);
      	printf("%s (%d bytes)", $file['name'], $file['size']);
      	print "
      ";
      }
      
      
      //CLOSE ARCHIVE
      $zip->close();
      
      ?>
      

        and it errors on:

        $zip = new ZipArchive();
        

        ???

          wierd... you have a module for xlib in phpinfo()... do you have one for Zip above it as well?

            Do you have

            extension=php_zip.dll

            in your php.ini and is it uncommented?

            For what it's worth, the ZipArchive class is rubbish at this stage (in my modest opinion). You might instead consider using Alexandre Tedeschi's dZip and dUnzip classes:

            dUnzip2: http://www.phpclasses.org/browse/package/2495.html

            Good luck!

              yea... kinda of like PHP's native mail function.. its pretty useless

                yes i followed the instructions at php.net for installation of the dll for zip functions

                I don't see a Zip on the php info just the Zlib

                  i don't spose anyone could help me install the "dZip and dUnzip classes"?

                  I need to be able to create zip files mainly

                    scrupul0us;10881825 wrote:

                    yea... kinda of like PHP's native mail function.. its pretty useless

                    I actually have no problems using the mail functions

                      6 months later
                      efficacious;10881887 wrote:

                      got it working guys thanks for the help

                      Yeah, care to share so the rest of us having problems can get some help?

                        9 months later

                        He probably went and used the code that I cited earlier in the thread.

                        If anybody is having a different problem, please state the specifics. Let's not hurt ourselves -- if the OP can't be bothered to post his solution, that's his problem.

                        I have access to Windows (albeit with Apache, not IIS), and I'm more than willing to test anyone's configuration on my machine.

                          Write a Reply...