我想在apache服务器中使用php提取一个zip文件。但我在这方面犯了一个错误。这是我的密码。
$enviornment = "zip -P test -r /var/www/test/test.zip /var/www/test/output/";
exec($enviornment, $output, $return);
echo "<pre>";
print_r($output);
这是错误消息。
[0] => zip I/O error: Permission denied
[1] => zip error: Could not create output file (/var/www/test/test.zip)
我已经在/var/www/test/output/文件夹中放置了权限。
您试图使用zip,但需要使用unzip-您正在做的是从/var/www/test/output/创建存档,查看手册页了解详细信息:
基本命令格式为
zip options archive inpath inpath ...
其中archive是一个新的或现有的zip归档,inpath是一个目录或文件路径,可选地包括通配符。当给予现有zip存档的名称,zip将完全替换zip档案中的命名条目(与档案中存储的相对名称相匹配)或为新名称添加条目。对于例如,如果foo.zip存在并且包含foo/file1和foo/file2,并且这个目录foo包含文件foo/file1和foo/file3,然后:
zip -r foo.zip foo or more concisely zip -r foo foo
将替换foo.zip中的foo/file1,并将foo/file3添加到foo.zip中。之后,foo.zip包含foo/filel、foo/file2和foo/file3foo/file2与以前相比没有变化。
请尝试解压缩,或者PHP的ZIP扩展http://php.net/manual/en/intro.zip.php