Question: I am stuck with an error “PHP Fatal error: Uncaught Error Class ZipArchive not found” in one of the opensource PHP application installed on our server. The server uses PHP 7.2 with Apache web server. Could you help me to fix this error?
Solution: Fix Class ZipArchive not found error
All you need is to install the ZipArchive package from the REMI repo for PHP 7.2 as shown below.
# yum-config-manager --enable remi-php72
# yum install php-pecl-zip
You may also search for the package using the below command and install the respective version.
# yum search zip | grep -i php
Restart apache web server as below:
# systemctl restart httpd
(or) In some versions of Apache.
# systemctl restart apache2
On Debian/Ubuntu:
# apt-get install php-zip # phpenmod zip # systemctl restart httpd