How to install Zip Extension for PHP 7.4 on CentOS 8

Posted September 5, 2021 4.8k views
ApachePHPCentOS 8

I’ve installed the php 7.4 on new system CentOS 8 but I’ve discovered that the ZIP extension is missing or not installed so I don’t know how to install with the new commands belongs to CentOS 8.

These steps I’ve done before:

> dnf module list php

# ---- OUTPUT ---- #    
php                         7.2 [d][e]                        common [d], devel, minimal                        PHP scripting language
php                         7.3                               common [d], devel, minimal                        PHP scripting language
php                         7.4                               common [d], devel, minimal                        PHP scripting language

> dnf module reset php

> dnf module enable php:7.4

> dnf module update php:7.4

> shutdown –r now


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Success with command php-zip only without version to install from new CentOS 8 AppStream

Thanks @alexdo

> dnf install php-zip

Last metadata expiration check: 3:50:20 ago on Sun 05 Sep 2021 05:09:48 PM UTC.
Dependencies resolved.
 Package                         Architecture              Version                                                   Repository                    Size
 php-pecl-zip                    x86_64                    1.18.2-1.module_el8.3.0+396+9a0d79d6                      appstream                     55 k
Installing dependencies:
 libzip                          x86_64                    1.6.1-1.module_el8.3.0+396+9a0d79d6                       appstream                     64 k

Hello, @HadyShaltout

You can follow our tutorial on How To Install Linux, Apache, MariaDB, PHP (LAMP) Stack on CentOS 8

To enable the EPEL repository for centOS 8

dnf install

To install zip and other necessary extensions:

  • dnf install php74-zip

After the installation is finished, you’ll need to restart the Apache webserver in order to enable the PHP module:

  • sudo systemctl restart httpd

Hope that this helps!

by Erika Heidi
A “LAMP” stack is a group of open source software that is typically installed together to enable a server to host dynamic websites and web apps written in PHP. This term is an acronym which represents the Linux operating system, with the Apache web server. The backend data is stored in a MariaDB database and the dynamic processing is handled by PHP. In this guide, you'll install a LAMP stack on a CentOS 8 server, using MariaDB as database system.
  • @alexdo Thanks for your help bro, But unfortunately not working

    > dnf install epel-release
    Last metadata expiration check: 2:11:36 ago on Sun 05 Sep 2021 05:09:48 PM UTC.
    Package epel-release-8-11.el8.noarch is already installed.
    Dependencies resolved.
    Nothing to do.
    > dnf install php74-zip
    Last metadata expiration check: 2:12:01 ago on Sun 05 Sep 2021 05:09:48 PM UTC.
    No match for argument: php74-zip
    Error: Unable to find a match: php74-zip