Page 1 of 1

XAMPP PHP8 Zip

PostPosted: 31. January 2023 17:28
by traymond
I'm working on implementing the PhpSpreadsheet (https://phpspreadsheet.readthedocs.io/) on PHP 8, using XAMPP with PHP 8.0x (not 8.1). All's well until it actually tries to write the file, and gives the following error:

Fatal error: Uncaught Error: Class "ZipStream\Option\Archive" not found in C:\xampp\htdocs\<snip>\phpspreadsheet\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Writer\Xlsx.php:549 Stack trace: #0 C:\xampp\htdocs\<clip>.php(2814): PhpOffice\PhpSpreadsheet\Writer\Xlsx->save('C:/ReportExport...') #1 {main} thrown in C:\xampp\htdocs\<clip>\phpspreadsheet\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Writer\Xlsx.php on line 549


The underlying problem is that the Zip extension's not included with XAMPP. Following https://www.php.net/manual/en/zip.installation.php - I tried to download the DLL, but they're for PHP 7.3 or 7.4. I've tried all 4 of the 7.4 versions, without success.

Any hints/suggestions on how to get the ZipArchive working? Thanks in advance for your time.

Re: XAMPP PHP8 Zip

PostPosted: 31. January 2023 20:00
by Altrea
PHP 8.2 comes with zip extension, but you need to activate it first.
To do so please follow these steps:

  • open your \xampp\php\php.ini
  • search for the following line
    Code: Select all
    ;extension=zip
  • remove the leading ; so that the line looks this
    Code: Select all
    extension=zip
  • save the file
  • restart Apache

Re: XAMPP PHP8 Zip

PostPosted: 02. February 2023 17:29
by traymond
Did that, no change. Still getting: "Fatal error: Uncaught Error: Class "ZipStream\Option\Archive" not found in ..."

Re: XAMPP PHP8 Zip

PostPosted: 02. February 2023 19:39
by Altrea
So probably a third party application problem?
https://github.com/PHPOffice/PhpSpreadsheet/issues/1617