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");
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
If you do own the machine, run sudo chmod 777 filename.zip
add this to your code.
And for more informations read php manual for chmod