No package php7.0-zip available

11,167

Solution 1

I had the same problem. I was getting:

No package php7.0-zip available. Error: Nothing to do

when running

yum install php7.0-zip

I first searched all yum packages by running:

yum search php70-zip

if returns nothing then run :

yum search php70-php-zip

if returned:

php70-zip.x86_64 : ZIP archive management extension for PHP

Then I installed the package that the search told me was there:

yum install php70-zip.x86_64

The installation worked like a charm. Then I restarted my apache server.

service httpd restart

Now php zip (for php7) is installed!

Solution 2

I had the same problem for PHP 7.1. I learned about yum search on the zip package:

$ yum --enablerepo=remi-php71 search php71 | grep zip
php71-php-pecl-zip.x86_64 : A ZIP archive management extension

I installed it:

$ sudo yum --enablerepo=remi-php71 install php71-php-pecl-zip

For some reason, the files zip.so and zip.ini were missing in /usr/lib64/php/modules and /etc/php.d/ directories respectively. So I copied them:

$ sudo cp /opt/remi/php71/root/usr/lib64/php/modules/zip.so /usr/lib64/php/modules/zip.so
$ sudo cp /etc/opt/remi/php71/php.d/40-zip.ini /etc/php.d/40-zip.ini

Finally, I restarted the services

$ sudo systemctl restart  php-fpm nginx

And I can see that zip is loaded:

$ php -m
[PHP Modules]
bz2
calendar
...
zip
zlib

Solution 3

As you are using some plesk package, this is not really a RHEL/CentOS server.

What is the package name providing the php command ?

rpm -qf $(which php)
  • If php-cli-7.1.12 (from remi-php71), you need php-pecl-zip from the same repository
  • If php71-php-cli-7.1.12 (from remi-safe, SCL package) you need php71-php-pecl-zip from the same repository

General rule, for any foo extension yum install package_namespace-foo should work, as explained by the Wizard.

Solution 4

I know is an old thread, but I faced same problem on CENTOS, and I solved similar (but quite different way):

yum search php70-zip

No Matches found

yum search php70-php-zip 

found this

ea-php70-php-zip.x86_64 : A module for PHP applications that need to handle .z
                    : files

then

sudo yum install ea-php70-php-zip.x86_64

and it was successfully installed

after that I restarted apache

sudo /etc/init.d/httpd restart

and problem was solved

I took me a lot of time, because I did not know package name, difficult for me, I found that on web: ea-php70-php-zip.x86_64

Share:
11,167

Related videos on Youtube

Dom
Author by

Dom

Updated on June 04, 2022

Comments

  • Dom
    Dom almost 2 years

    I'm running php7 on a redhat machine and am getting the following error in laravel:

    Class 'ZipArchive' not found
    

    I had this issue on my personal virtual machine server and all I had to do was run:

    sudo yum install php7.0-zip
    

    On my dev server I tried running the command and I get:

    sudo yum install php7.0-zip
    Loaded plugins: product-id, search-disabled-repos, subscription-manager
    No package php7.0-zip available.
    

    Just for more information here is my php version:

    php -v
    PHP 7.1.12 (cli) (built: Dec  1 2017 13:53:12) ( NTS )
    Copyright (c) 1997-2017 The PHP Group
    Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    

    Edit: If I run php7.1-zip

    sudo yum install php7.1-zip
    Loaded plugins: product-id, search-disabled-repos, subscription-manager
    epel/x86_64/metalink                                     |  16 kB     00:00     
    gitlab_gitlab-ee/x86_64/signature                        |  836 B     00:00     
    gitlab_gitlab-ee/x86_64/signature                        | 1.0 kB     00:00 !!! 
    gitlab_gitlab-ee-source/signature                        |  836 B     00:00     
    gitlab_gitlab-ee-source/signature                        |  951 B     00:00 !!! 
    icinga-stable-release                                    | 2.5 kB     00:00     
    jenkins                                                  | 2.9 kB     00:00     
    plesk-php-5.6                                            | 2.9 kB     00:00     
    plesk-php-7.0                                            | 2.9 kB     00:00     
    remi-php71                                               | 2.9 kB     00:00     
    remi-safe                                                | 2.9 kB     00:00     
    (1/2): remi-php71/primary_db                               | 208 kB   00:00     
    (2/2): remi-safe/primary_db                                | 1.1 MB   00:01     
    No package php7.1-zip available.
    Error: Nothing to do
    
    • iainn
      iainn over 6 years
      The output to php -v shows that you're running PHP 7.1, so installing php7.0-zip doesn't sound right.
    • Dom
      Dom over 6 years
      I'll edit my comment to show what happens when I run php7.1-zip
  • Dom
    Dom over 6 years
    7.1 yields the same result. php-zip works installs but doesn't fix my issue. php-zip is for pre-php7 right?
  • Pierre Vassoilles
    Pierre Vassoilles over 6 years
    php-zip works fine for me with php7.0 on Ubuntu 16.04. (For older php versions, I think you have to recompile php with option --enable-zip) Have you restarted your webserver (apache/nginx/other) after the package install ? (just in case of...) Else, you can also see if the extension is installed and enabled with the cli command "php -i | grep zip"
  • Remi Collet
    Remi Collet about 5 years
    See my answer above, proper way is to install php-pecl-zip NOT php71-php-pecl-zip
  • kiatng
    kiatng about 5 years
    @remi Thanks, I actually read your answer, I thought I was following your way. So it seems I actually don't quite understand what you wrote; I am quite a noob. But the steps I described resolved the issue for me, I'm now moved on. If I need to do another setup, I will see if $ sudo yum --enablerepo=remi-php71 install php-pecl-zip would work better, ie, without copying files. I appreciate your time in helping noob like me, who prefers to spend time developing app rather than setting up servers.