问题描述
我正在尝试压缩文件,我想将权限设置为chmod777。但是我不知道我应该如何/在何处编写chmod777。有人可以帮我吗?这是我的文件压缩代码。
I am trying to zip files and I want to set the permission to chmod 777. But i don't know how/where I should write the chmod 777. Could anyone please help me? This is my code for zipping files.
$files = array(
'download.xml',
'script_.xml',
);
$zip = new ZipArchive();
$zip_name = "testabc.package";
if($zip->open($zip_name, ZIPARCHIVE::CREATE)!==TRUE){
$error .= "* Sorry ZIP creation failed at this time";
}
foreach($files as $file){
$zip->addFile($file);
}
$zip->close();
echo shell_exec("zip -P pass test.zip script.xml");
推荐答案
可能您没有所需的更改许可文件权限。我建议与您的托管服务提供商联系,让他们为您更改它。通常,对任何文件进行设置都是非常不好的777许可。请参阅:
It's possible you do not have the required permission to change file permissions. I would suggest contacting your hosting provider to have them change it for you. Generally, 777 is a very bad permission to have set on any file. See: https://webmasters.stackexchange.com/questions/18280/why-chmod-777-is-not-secure
如果您拥有计算机,请运行sudo chmod 777 filename.zip
If you do own the machine, run sudo chmod 777 filename.zip
这篇关于如何将权限777设置为一个zip文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!