I'm trying to unzip a Zip archive in PHP using extractTo. The PHP script is running via the web browser i.e. as "nobody".
The logic and flow:
creates a new subdirectory (e.g. "abc"), with permissions 0777 and owner "nobody" under document root (i.e. one level above public_html)
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".
creates an "unzipped" subdirectory under abc, permissions 0777 / nobody
calls
extractToto unzip the zip file to the unzipped subdirectory.
The code is:
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