Describe the issue or problem
We have the same problem solved here, our IT made the change suggested by @asmecher but the download all button still make a 0 byte zip file
Steps I took leading up to the issue
Here what our IT did:
cat = print the file
-n = with line numbers
grep import = where you find the word import
Hello,
this is the apache errors log when you try to download a zip package:
[Fri Mar 03 17:00:54.678093 2023] [proxy_fcgi:error] [pid 16316] (32)Broken pipe: [client XX.XXX.XX.XX:XXXX] AH01075: Error dispatching request to : (passing brigade to output filters)
[Fri Mar 03 17:00:54.870282 2023] [proxy_fcgi:error] [pid 16174] [client XX.XX.XX.XXX:XXXXX] AH01071: Got error 'PHP message: PHP Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 39PHP
message: PHP Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 39PHP
message: PHP Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 39PHP
message: PHP Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 39PHP
message: PHP Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 39PHP
message: PHP Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 39PHP
message: PHP Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 39PHP
message: PHP Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 39PHP
message: PHP Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 39PHP
message: PHP Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 39PHP
message: PHP Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 39PHP
message: PHP Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 39PHP
message: PHP Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 39PHP
message: PHP Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 39PHP
message: PHP Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 39PHP
message: PHP Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 39PHP
message: PHP Warning: ZipArchive::close(): Invalid or uninitialized Zip object in /my-ojs-www-path/lib/pkp/classes/file/FileArchive.inc.php on line 41', referer: https://myojs/index.php/myjournal/workflow/index/12345/1
Hmm, I can’t think of any other requirements for that feature. I’m afraid you’ll have to inspect the code directly and see where it’s failing; I wonder whether something internal to your server is missing/badly configured.
Before digging further, ensure that clicking each file individually results in a successful download; if these files are missing it could cause ZipArchive to complain.
You could try running a PHP test script outside of OJS to verify that the ZipArchive tools are working. See the examples here:
Are you trying the test script via web-based invocation, or from the command line? These might have different file permission requirements, and different PHP configuration files.
Regards,
Alec Smecher
Public Knowledge Project Team
The “download all” link is implemented in lib/pkp/controllers/api/file/FileApiHandler.inc.php in the downloadAllFiles function, which in turn uses the lib/pkp/classes/file/FileArchive.inc.php class. I’d suggest using some error_log calls in FileArchive.inc.php to see if you can identify where the process is going awry.
Regards,
Alec Smecher
Public Knowledge Project Team
Ah, that was they key! I was able to identify the difference between your system and mine: apparently yours has a newer version of libzip that does not accept an empty file as a valid archive as noted in the PHP ZipArchive documentation.
I’ve filed and fixed this here:
Thanks for tracking this down!
Regards,
Alec Smecher
Public Knowledge Project Team