php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30326 "zip_open" cannot open file
Submitted: 2004-10-05 02:45 UTC Modified: 2010-12-20 14:52 UTC
Votes:4
Avg. Score:4.5 ± 0.5
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:2 (50.0%)
From: adamsbarker at hotmail dot com Assigned:
Status: Not a bug Package: Zip Related
PHP Version: 5.0.2 OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: adamsbarker at hotmail dot com
New email:
PHP Version: OS:

 

 [2004-10-05 02:45 UTC] adamsbarker at hotmail dot com
Description:
------------
when using the following code:

zip_open('file_name.zip');

i get the following error:

----------------
Warning: zip_open() [function.zip-open]: Cannot open zip archive file_name.zip in C:\test.php on line 1
----------------

the "zip file" and "php script" are in the same directory

when i put in the full directory of the zip file, such as "C:\file_name.zip", the file is opened and everything works as expected.
i don't think this should be how it works as all other functions (ie, include()) don't need the full directory!

i am using the latest stable version 5.0.3-dev and PECL extensions


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-06 01:17 UTC] iliaa@php.net
Is the script being ran from the same directory as the one where the zip file is?
 [2004-10-06 11:19 UTC] adamsbarker at hotmail dot com
yes, both the "php" and "zip" files are in the same directory... i completely removed php and got copies of the latest stable version/PECL extensions for Windows, but still the same problem... this problem seems to be running throughout the versions, since i first noticed it a couple of months ago.
 [2004-10-06 11:22 UTC] derick@php.net
it probably means that the working directory is different then you think it is. What does echo getcwd(); output?
 [2004-10-07 01:13 UTC] adamsbarker at hotmail dot com
This is how i've done it:

- my home directory is "D:\home"
- both "open_zip.php" AND "abc.zip" are in "D:\home"
- zip_open('D:\home\abc.zip');
  - this works perfectly
- zip_open('abc.zip');
  - has this error:
    Warning: zip_open() [function.zip-open]: Cannot open zip archive abc.zip in D:\home\open_zip.php on line 3
  - echo getcwd(); => produces this:
    D:\home


i hope this makes sense :)
 [2004-11-28 13:54 UTC] tony2001@php.net
Please, check that your web-server has all necessary NTFS permissions to read this file.
 [2004-12-06 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2004-12-14 09:11 UTC] greg at catalina-it dot com dot au
I have found the same thing. I have a zip file in the same dir as the zip file, and under Windows XP (PHP 4.3.8) and zip_open() cant open it. When I include the full path from C: etc it works fine. This certainly looks like a bug, at least up to 4.3.8. Can someone try it on later versions to see if the bug has been fixed or not.
 [2004-12-14 09:20 UTC] adamsbarker at hotmail dot com
i am still having problems using the latest snapshots - so i would have to say it hasn't changed
 [2004-12-14 09:31 UTC] greg at catalina-it dot com dot au
Adam, thanks for the info. I'm not sure what happens from here. This seems to be a long standing bug, not receiving much attention.
 [2004-12-17 20:01 UTC] info at 7eddi dot de
ajbaas wrote on php.net/zip_open :

"note: if you are using PHP in module mode, the open_zip function will need an absolute path to the file, because it is not aware of it's whereabouts. this is for win32 at least."
 [2005-02-28 21:23 UTC] sniper@php.net
This extension was moved to PECL, please report this bug there if you still can reproduce with the latest version of it.

 [2010-12-20 14:52 UTC] jani@php.net
-Package: ZZiplib Related +Package: Zip Related
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jan 04 10:01:29 2025 UTC