Get in touch
or send us a question?

Amazon Linux 2023 Zip Install

Step 1: SSH into Your Amazon Linux Instance

Step 2: Run DNF Update

Although it is not necessary, if you have not updated your system for a while then run the given command. It will refresh the package manager cache as well.

sudo dnf update

Step 3: Install the PHP dev package and other dependencies

As we don’t have a PHP-zip extension to install directly from the system repository of Amazon Linux 2023 while writing this article, we will install it using PECL, which is a repository for PHP Extensions. And for that, we need the packages given in the following command:

sudo dnf install php-devel php-pear libzip libzip-devel

Step 4: Install PHP-ZIP on Amazon Linux 2023

Once you are done and got the PECL using the previous command of this tutorial, we can use it for installing the ZIP extension of PHP. On your terminal run:

sudo pecl install zip

Step 5: Enable php-zip extension

The module will be installed under /usr/lib64/php8.2/modulesNote: replace php8.2 with the version you currently have on your system of PHP, if you want to check. Now, to enable it, create an INI file for the module, here is the command to do that:

echo "" | sudo tee /etc/php.d/20-zip.ini

Step 6: Restart Apache and PHP-FPM

To apply the changes you have made and make the ZIP extension discoverable by your web application, restart the HTTPD and PHP-FPM services on your Amazon Linux:

sudo systemctl restart httpd
sudo systemctl restart php-fpm

Step 7: Verify the Installation

There are multiple ways to verify the extension we have installed is enabled to use for PHP-based applications or not, here are a few:

Method 1# Using PHP command:

php -m

You will see the list of PHP extensions installed on your system

check all installed php modules