SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Oct 2009
    Location
    London, UK
    Posts
    382
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Zip support with zlib

    Hi there,

    I'm running php 5.2.15 on an apache server, and I want to be able to open and read zip archives with php.

    Phpinfo is telling me that zlib is enabled:

    '--with-zlib=/usr' '--with-zlib-dir=/usr' (Yes, it does appear twice)

    but I don't think I installed it, unless it ships with this release of php.

    I have tried to use ZipArchive and zip->open commands and I'm not getting any joy. So I guess two questions arise. 1. Is there anyway of finding out for sure if zlib is actually installed, and 2. Could the --with-zlib command actually be pointing to the wrong folder? I guess the directory should be where the library is stored, rather than where my php files are..?

    Many thanks,
    Mike

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    This will tell you if it is available.
    PHP Code:
    <?php
    printf
    (
      
    'Is ZipArchive Available? %s',
      
    class_exists('ZipArchive') ? 'Yes :)' 'No :('
    );
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Addict
    Join Date
    Oct 2009
    Location
    London, UK
    Posts
    382
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thanks Anthony, a very elegant code snippet.

    It appears I do have ZipArchive support! Whoo-hoo! I guess it was because i was running functions directly form the command-line..?

    Anyways, thanks for your help. Much appreciated.
    M


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •