Avoiding permissions problems when creating Zip files in PHP

A typical PHP snippet to create a Zip file looks something like this: $zip = new ZipArchive(); $zipname = ‘package_name.zip’; if ( true === $zip->open( $zipname, ZipArchive::CREATE ) ) { $zip->addFromString( ‘file_name.txt’, $file_contents ); $zip->close(); header( ‘Content-Type: application/zip’ ); header( ‘Content-disposition: attachment; filename=’ . $zipname ); header( ‘Content-Length: ‘ . filesize( $zipname ) ); readfile(… Read more Avoiding permissions problems when creating Zip files in PHP