SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Smart programmer silver trophy M.Zeb Khan's Avatar
    Join Date
    Jan 2004
    Location
    Luton, Beds
    Posts
    1,792
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy ZipArchive not working!

    Hi,

    I'm using PHP 5.2.6, and the ZipArchive function just doesn't work.

    Please take a look at the following code:
    PHP Code:
       $zip = new ZipArchive;
       
    $zip->open("test.zip"ZipArchive::CREATE);
       
    $zip->addFile("File.php""File.php"); 
    Even though if I manually create test.zip and put it in that folder, it still won't add File.php into the archive,

    Thanks in advance

    PS: it doesn't show any errors, even its E_ALL,

  2. #2
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:
    PHP Code:
    $zip = new ZipArchive;
    $r $zip->open('test.zip'ZipArchive::CREATE);
    var_dump($r);

    $r $zip->addFile('test.php''test.php');
    var_dump($r);

    $r $zip->close();
    var_dump($r); 
    what is the output?
    what operating system?
    my mobile portal
    ghiris.ro

  3. #3
    Smart programmer silver trophy M.Zeb Khan's Avatar
    Join Date
    Jan 2004
    Location
    Luton, Beds
    Posts
    1,792
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ernie,

    Thanks for your help.

    I used that code, but it doesn't show anything at all, just a blank screen . is it because the errors or disabled or what, I'm also using error_reporting(E_ALL);, but still its a blank screen.

    Please take a look at my phpinfo():
    http://www.mzeb.com/php.html

    Thanks

  4. #4
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check the folder permissions. From the PHP Manual user notes:

    rickky at gmail dot com (02-Jul-2007 01:07)

    If the directory you are writing or saving into does not have the correct permissions set, you won't get any error messages and it will look like everything worked fine... except it won't have changed!
    Instead make sure you collect the return value of ZipArchive::close(). If it is false... it didn't work.
    Still doesn't explain why var_dump() doesn't display the return values in your case though.

  5. #5
    Smart programmer silver trophy M.Zeb Khan's Avatar
    Join Date
    Jan 2004
    Location
    Luton, Beds
    Posts
    1,792
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by World Wide Weird View Post
    Check the folder permissions.
    I've changed it to 777, still blank screen

  6. #6
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    According to your phpinfo(), the Zip extension is not installed. If it was, you'd see something like this:


    zip

    Zip enabled
    Extension Version $Id: php_zip.c,v 1.1.2.15 2006/09/24 22:27:57 pajoye Exp $
    Zip version 2.0.0
    Libzip version 0.7.1

    It's amazing that you're not getting "class doesn't exist" error messages. Something must be going on with your error handling.

  7. #7
    Smart programmer silver trophy M.Zeb Khan's Avatar
    Join Date
    Jan 2004
    Location
    Luton, Beds
    Posts
    1,792
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes exactly, it might be zip not enabled, but the damn problem is even if I use a strange class name which would never exist, it still doesn't give any error

    I'll deal with my server guys now,

    Thanks for your help


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
  •