'PhpSpreadSheet Class ZipArchive not found Error
I've just downloaded PhpSpreadsheet package via composer and I tried to generate an Excel spreadsheet. But all I get is an error "Class ZipArchive not found ". I work on Windows. In my localhost it is correctly generating excel. My localhost php version is 7.0.2 .But server Php Version is 5.6. I am not able to generate excel in server. I am getting "*Class ZipArchive not found" error.
Solution 1:[1]
I think you just need the PHP "zip" extension on your server... If I understand well, your dev machine is on Windows. But your "production" machine is on... Linux?
If it's Debian :
apt-get install php-zip
If it's RedHat or whatever
yum install...
Solution 2:[2]
I update the Ubuntu 16.04 with php5.6 to Ubuntu 18.04 with php7.2.
Solved the same erorr with installing the php-zip as in the first post: sudo apt-get install php-zip
, then restart the apache server: sudo service apache2 restart
.
Solution 3:[3]
You have to reference ZipArchive in your PHP code:
use ZipArchive;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Worst |
Solution 2 | Mihai Neagu |
Solution 3 | Juan Cantarero |