|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48338 extractTo - unexpected results
Submitted: 2009-05-19 22:28 UTC Modified: 2009-05-19 23:24 UTC
From: bugreport at hotmail dot co dot uk Assigned:
Status: Not a bug Package: Zip Related
PHP Version: 5.2.9 OS: CENTOS 5.2 i686 xen on server
Private report: No CVE-ID: None
 [2009-05-19 22:28 UTC] bugreport at hotmail dot co dot uk
I am trying to unpack a Zip file.  Permissions on both the Zip file and the destination directory (which is the same directory as the Zip file is in) are set to 0777.

Running extractTo (zlib 1.2.3 installed) using code from example 1 at

results in no return to the browser (and the Zip file not being unpacked).

Changing the above to

	$directory = '/path/...../';

results in " Warning: ZipArchive::extractTo() [ziparchive.extractto]: Permission denied in /path/....../script_file_name.php on line 12 "

Again the Zip file is not unpacked.

Reproduce code:

	$zip = new ZipArchive;

	if ($zip->open('/path/...../') === TRUE)
    echo 'ok';
    echo 'failed';

Expected result:
Echo 'ok' (or 'failed')
Zip file unpacked

Actual result:
Nothing returned to the browser.
Zip file not unpacked.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-19 23:01 UTC]
Works fine when your permissions are correct. Make sure the user as 
which your webserver runs as has permissions to write and execute to 
that path.
 [2009-05-19 23:24 UTC] bugreport at hotmail dot co dot uk
Hi, thanks for your reply.

Just run some more tests, turned out to be a problem with the Zip files I was receiving.  These opened fine when downloaded and opened with Windows, but gave the results documented when opened on the server.  I've since tried opening Zip files from different sources on the server which open fine.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Jun 13 01:01:23 2021 UTC