I found that PHP script generated zip files cannot be restored for execution if the compression was done using PHP 5.6 to PHP 7.3. Zip file restoration / decompression, to run PHP scripts, only works if the PHP scripts were zipped under PHP 5.5.
While testing, using ZipArchive function, I found that, with PHP 5.5 all file permissions are set to 0644. It does not matter whether the original file permissions were set to 0666 or 0444 or any other value. When you unzip the file the the permissions will be set to 0644.
I then tested this with PHP 5.6 and tried to zip and unzip files whose permissions were 0644 or 0444. When unzipped their permissions where set to 0666.
PHP programs zipped up with PHP versions 5.6 to 7.3 would not work when unzipped on my and other servers unless I manually changed all file permissions to 0644 and all directory permissions to 0755. Where as higher versions of PHP, 5.6 to 7.3, set file permissions to 0666 which stops them from being executed - the unzipped php files will not run. I have written more about this at http://drpetersnews.com/php-zip-archive-not-working-apache-server-hard-disk-full-problems.php and have reported this to PHP developers at https://bugs.php.net/bug.php?id=69536.
Actually, ZipArchive can work correctly if we, as the PHP script developer, use the ZipArchive function to set the file and directory permissions. For example with additions to PHP statements:
$zipArchive->addFile('atestzip.php', 'atestzip.php', 0644);
$zipArchive->addEmptyDir ( string $dirname, 0755 );
There could be a way to create default settings for directory and file permissions:-
$zipArchive->setpermissions ( 0755, 0644 );
I love using ZipArchive functions and have a lot of PHP code that generates zip files. And it is very easy to use Windows Explorer to search the contents of zip files when I am trying to find something in my zip files. Furthermore, I release a lot of PHP code in zipped up files but unfortunately I am unable to migrate to PHP 5.6 or higher because ZipArchive does not work properly on the higher versions of PHP. Therefore, I am now stuck with PHP 5.5.
I still believe zipped files are a wonderful product and very easy to use and distribute.
Can you guys help me get the PHP developers upgrade PHP so that all versions of PHP from 5.6 to 7.3 will zip files with the correct permissions?