views:

576

answers:

1

Hi

I'm trying to unzip a Zip archive in PHP using extractTo. The PHP script is running via the webbrowser i.e. as "nobody".

The script:

1) creates a new subdirectory (e.g. "abc"), with permissions 0777 and owner "nobody" under document root (i.e. one level above public_html)

2) copies the Zip file (from an incoming FTP directory under public_html) to the abc subdirectory. Permissions on this Zip file are set to 0777, owner "nobody".

3) creates an "unzipped" subdirectory under abc, permissions 0777 / nobody

4) calls extractTo to unzip the zip file to the unzipped subdirectory via:

  if ($zip->extractTo('$abc_unzipped_path') === TRUE)
    {
     [more code]
    }

Step 4 results in the php script returning the following error: "ZipArchive::extractTo() [ziparchive.extractto]: Permission denied in [script path and name] on line [line number of extractTo call]"

Can anyone see where the problem with the permissions might be please?

PHP version 5.2.9 Zlib 1.2.3

A: 

... turns out the problem was with the zip file itself, which variously caused the above errors, or no error message at all (script crash)