简体   繁体   English

PHP警告ZipArchive :: extractTo():权限被拒绝

[英]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. 我创建了一个应用程序,它使用类ZipArchive(php中的标准)中的方法extractTo(),我在Windows 7上的localhost apache服务器上测试它没有任何问题。 But after I tried it on some unix production server, it just throws 但是在我在一些unix生产服务器上尝试之后,它就抛出了

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. 我甚至在0777上为应用程序使用的每个文件夹设置了chmod,但它没有帮助。

Do you have any idea what's wrong? 你知道什么是错的吗?

For linux / macosx user, change 对于linux / macosx用户,请更改

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

To

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

Can help too. 也可以帮忙。

Check if the user running Apache (sometimes a user "www-data") has access to the zip file in question. 检查运行Apache的用户(有时是用户“www-data”)是否可以访问相关的zip文件。

Also try changing the owner of the file to the user running Apache (check top for the user). 还尝试将文件的所有者更改为运行Apache的用户(请检查用户的top )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM