Question

How to install Zip Extension for PHP 7.4 on CentOS 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

Thanks


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Accepted Answer

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
========================================================================================================================================================
Installing:
 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

https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-on-centos-8

To enable the EPEL repository for centOS 8

dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

To install zip and other necessary extensions:

  1. dnf install php74-zip

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

  1. sudo systemctl restart httpd

Hope that this helps! Regards, Alex