1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Class zipArchive not found

Discussion in 'General Discussion' started by onaweb, Nov 17, 2006.

  1. onaweb

    onaweb Member

    Joined:
    Jan 1, 2004
    Messages:
    76
    Likes Received:
    0
    Trophy Points:
    6
    We are trying to unzip a file. We are running php 5.2.0 with zip on a WHM 10.8.0 cPanel 10.9.0-R57 CentOS 4.4 i686 - WHM X v3.1.0

    After upgrading to 5.2.0, we
    ./configure --enable-zip
    make
    make install
    no errors, but in the phpinfo it does not show enable zip and when we try to open the zip file we receive the error:
    Class ZipArchive not found

    Any help would be greatly appreciated.

    Thanks for all your help,
    Andy
     
  2. Rafaelfpviana

    Rafaelfpviana Member

    Joined:
    Mar 12, 2004
    Messages:
    142
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Brazil
    hello there,

    this week I had a custumer with the same problem and what I learned was that eventhough PHP.net says that PHP 5.2 comes with the ZIP library as bundle for some reason PHP on Cpanel servers don't get compiled with it.

    This isn't new, the compile Apache has the Zip option but I never saw it working, and I've tested on 10 different servers.

    What I suggest is that you compile de PECL availble here http://pecl.php.net/package/zip

    well, good luck.
     
  3. Rafaelfpviana

    Rafaelfpviana Member

    Joined:
    Mar 12, 2004
    Messages:
    142
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Brazil
    ok, to install the ZIP PECL library do this:

    first create a phpinfo file to get necessary informations, like this:

    PHP:
    <?
    phpinfo();
    ?>
    save it as phpinfo.php any where in the server, but remember, you are going to need to see this file on a browser.

    open the browser and open that phpinfo file that you've just created and search for these 2 values:

    Configuration File (php.ini) Path

    and

    extension_dir

    login into your server as root and type this:

    Code:
    cd /usr/src/
    wget http://pecl.php.net/get/zip-1.8.0.tgz
    tar -xzf zip-1.8.0.tgz
    rm -f zip-1.8.0.tgz
    cd ./zip-1.8.0
    phpize
    ./configure
    make
    make install
    
    when you type make install something like this will be written on the screen:

    Code:
    Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20060613/
    
    write that down somewhere, copy and paste it on a notepad.

    what you just did was compile the library, now you need to edit php.ini file to turn the extension on:

    Code:
    vi you_php_ini_path_here
    
    type / to search and search for enable_dl and make sure this is set to on


    type / to search and search for extension_dir and paste the thing I told you to paste on the notepad, so it looks something like this:

    Code:
    extension_dir   = "/usr/local/lib/php/extensions/no-debug-non-zts-20050922/";
    
    now right bellow that add this

    Code:
    extension=zip.so
    
    now just restart apache and look at the phpinfo file.

    any questions, just ask :)
     
    #3 Rafaelfpviana, Nov 21, 2006
    Last edited: Nov 21, 2006
  4. domflann

    domflann New Member

    Joined:
    Nov 24, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    i did everything that you said, and it seemed to work perfectly. I restarted apache and looked at my phpinfo file. Now how would i install the --enable-zip for php. I can't seem to find the php directory that has the configure command. I've done a find / -name 'configure' and there are a few for other programs, but nothing for php. Yet php is on the server and working, because my phpinfo page works.

    The extension_dir is correct on the phpinfo file too.
     
    #4 domflann, Nov 24, 2006
    Last edited: Nov 24, 2006

Share This Page