ZipArchive not found but appears to be installed (PHP 7.2)

user2265915 picture user2265915 · Feb 16, 2018 · Viewed 13.9k times · Source

I'm installing a CMS that requires ZipArchive on an Amazon EC2 instance (Amazon Linux 2). The requirements wizard says ZipArchive is not supported:

enter image description here

But if I try to install ZipArchive as per instructions I've found online, the server tells me it's already installed:

[ec2-user@ip-***-**-**-** ~]$ sudo yum install php-zip
Loaded plugins: langpacks, priorities, update-motd
amzn2-core                                                                                                                                                                         | 2.0 kB  00:00:00     
Package matching php-common-5.4.16-43.amzn2.0.1.x86_64 already installed. Checking for update.
Nothing to do

I have restarted the httpd service.

I have also tried:

[ec2-user@ip-***-**-**-** ~]$ sudo yum install php7.0-zip
Loaded plugins: langpacks, priorities, update-motd
amzn2-core                                                                                                                                                                         | 2.0 kB  00:00:00     
No package php7.0-zip available.
Error: Nothing to do

I have also tried adding:

extension=zip.so

To php.ini and restarted the httpd service. Still no joy.

In the PHP manual for ZipArchive it says "In order to use these functions you must compile PHP with zip support by using the --enable-zip configure option." I'm not sure where or when to do this. I have simply used:

yum install php php-mysql

To install PHP.

Almost a day trying to work this out and I'm at a loss as to where to go from here. Can somebody point me in the right direction?

Answer

andychukse picture andychukse · Apr 18, 2018

If you are using Remi's repo, I noticed the zip module is a pecl extension, so to install and enable zip run

 sudo yum -y install php-pecl-zip

Then restart php-fpm is you are using NGINX or restart APACHE

 sudo service php-fpm restart
 sudo service httpd restart

You can install Remi repo

**RHEL or CentOS**
yum install yum-utils
yum-config-manager --enable remi-php72

See instructions on Remi Repo