Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Warning ZipArchive::extractTo(): Permission denied

I created an application, which using method extractTo() in class ZipArchive (standard in php) and I tested it on my localhost apache server on Windows 7 without any problem. But after I tried it on some unix production server, it just throws

Warning: ZipArchive::extractTo(): Permission denied in /path/to/file.php on line 27

I even set chmod on 0777 for every folder which is used by application, but it doesn't help.

Do you have any idea what's wrong?

like image 794
Lukáš Jelič Avatar asked Sep 16 '12 11:09

Lukáš Jelič


2 Answers

For linux / macosx user, change

$zip->extractTo('/Directory/');

To

$zip->extractTo('Directory/');

Can help too.

like image 190
csblo Avatar answered Sep 24 '22 13:09

csblo


Check if the user running Apache (sometimes a user "www-data") has access to the zip file in question.

Also try changing the owner of the file to the user running Apache (check top for the user).

like image 37
Peter Ilfrich Avatar answered Sep 22 '22 13:09

Peter Ilfrich