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.
Asked
Active
Viewed 9,903 times
6
-
Please [edit] to add meaningful code and a problem description here. Posting a [Minimal, Complete, Verifiable Example](http://$SITEURL$/help/mcve) that demonstrates your problem would help you get better answers. Thanks! – anothernode Apr 20 '18 at 14:07
-
Hi there Ambili. Stack Overflow is here to _help_ you solve your problems. It is *not* there to solve the problems for you. Please do your research before asking questions, which have already been asked: https://stackoverflow.com/questions/3872555/fatal-error-class-ziparchive-not-found-in. – Avius Nov 16 '20 at 22:16
3 Answers
8
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...

Worst
- 169
- 8
0
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
.
-2
You have to reference ZipArchive in your PHP code:
use ZipArchive;
-
Hi Juan, welcome to SO! You've posted a poor answer to an equally poor question, which is not great. Please see https://stackoverflow.com/help/how-to-answer for more information. If you really think you know the exact issue the OP is facing, you could improve this answer by explaining the problem and using syntax highlighting for the code. Although this question has already been asked and answered, possibly multiple times. – Avius Nov 16 '20 at 22:15