SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Nov 2009
    Posts
    310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using ZipArchive class

    Hi,

    Is there any requirement to use PHP's ZipArchive class? I mean any extensions to be activated etc.? when I checked my php.ini file, I noticed an extension named as php_zip.dll but it was inactive (commented out). The zip script I used worked but I wanted to make sure it will work on other servers too.

    Thanks.

  2. #2
    SitePoint Wizard
    Join Date
    Oct 2005
    Posts
    1,833
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    DLL files are for Windows only. From the PHP documentation, assuming you are referring to this zip functionality, zip must be compiled into PHP on Linux servers. It probably is on most servers. To be sure, you can run phpinfo() and output your particular server's PHP settings. Look at the output in the zip section. If it lists a Zip section with version information, you have it and don't need to make any ini entries.

    PHP Code:
    <?php
    phpinfo
    ();
    ?>

  3. #3
    SitePoint Addict
    Join Date
    Nov 2009
    Posts
    310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cheesedude View Post
    DLL files are for Windows only. From the PHP documentation, assuming you are referring to this zip functionality, zip must be compiled into PHP on Linux servers. It probably is on most servers. To be sure, you can run phpinfo() and output your particular server's PHP settings. Look at the output in the zip section. If it lists a Zip section with version information, you have it and don't need to make any ini entries.

    PHP Code:
    <?php
    phpinfo
    ();
    ?>
    Well, I am working locally on Windows (basic Apache+PHP setup, not IIS) and it works with php_zip.dll file not activated. I checked phpinfo() and it has a Zip section. My hosting is a linux server and it works on it either. The problem is, this is an application that I will distribute, so I need to make sure it will work on all possible setups. Based on your answer, let's say some servers don't have Zip enabled, is it possible to make a php.ini entry within my script? Or, should I look for a way to create zip files without using ZipArchive class?

  4. #4
    SitePoint Wizard
    Join Date
    Oct 2005
    Posts
    1,833
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by nayen View Post
    The problem is, this is an application that I will distribute, so I need to make sure it will work on all possible setups. Based on your answer, let's say some servers don't have Zip enabled, is it possible to make a php.ini entry within my script? Or, should I look for a way to create zip files without using ZipArchive class?
    When someone makes a script for distribution (like Wordpress, phpBB, or whatever), they list the requirements necessary to run it. It isn't possible for them to custom tailor their script to every possible scenario. Zip support is pretty standard, at least on servers running Linux. I wouldn't even concern myself with it. Most of the time it will be available. As far as making an ini entry to enable zip support, that isn't going to be possible on a shared server and I believe Zip has to be compiled into PHP on Linux setups.

  5. #5
    SitePoint Addict
    Join Date
    Nov 2009
    Posts
    310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cheesedude View Post
    When someone makes a script for distribution (like Wordpress, phpBB, or whatever), they list the requirements necessary to run it. It isn't possible for them to custom tailor their script to every possible scenario. Zip support is pretty standard, at least on servers running Linux. I wouldn't even concern myself with it. Most of the time it will be available. As far as making an ini entry to enable zip support, that isn't going to be possible on a shared server and I believe Zip has to be compiled into PHP on Linux setups.
    Thanks for clarification.


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
  •