Era Host hosting
EraHost – Free Domain, Cheap Hosting!
Client Area
Support 24/7
Menu

Install ZIP Extension for OpenCart Based on OS & PHP Version

5 min read
02.06.2026

1. Identify Your PHP Version

Important: Before installing any extension, you must know which PHP version is running on your server. Web servers often run different PHP versions than the command line.

Check your PHP version with this command:

PHP ZIP Extension Install
php-zip per distro + per PHP version; restart matching SAPI.

For the OpenCart-specific error variant and related extensions, see Fix "ZIP Extension Needs to Be Loaded" in OpenCart, Install ImageMagick or GD — Admin Guide, and How to Install & Optimize OpenCart on a VPS.

php -v

Example Output:

PHP 7.4.33 (cli) (built: Nov 25 2023)
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

Take note of your PHP version (e.g., 7.4, 8.0, 8.1, 8.2). This will determine which package you need to install.

For the web server's PHP version (which might differ), create a temporary test file:

echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/phpinfo_test.php

Visit http://yourdomain.com/phpinfo_test.php and look for the PHP version. Delete this file after checking:

sudo rm /var/www/html/phpinfo_test.php

2. Install ZIP Extension on Ubuntu/Debian

For Ubuntu/Debian systems, use the appropriate package based on your PHP version:

For PHP 7.4

sudo apt update
sudo apt install php7.4-zip -y

For PHP 8.0

sudo apt install php8.0-zip -y

For PHP 8.1

sudo apt install php8.1-zip -y

For PHP 8.2

sudo apt install php8.2-zip -y

For PHP 8.3

sudo apt install php8.3-zip -y

If you're unsure which version-specific package is available, you can search:

apt search php.*-zip

3. Install ZIP Extension on CentOS/RHEL

Note: On CentOS/RHEL, you often need the Remi repository for version-specific PHP packages. Enable it first if needed:
sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum-config-manager --enable remi-php74  # For PHP 7.4

For PHP 7.4 (using Remi repository)

sudo yum install php74-php-zip -y

For PHP 8.0 (using Remi repository)

sudo yum install php80-php-zip -y

For PHP 8.1 (using Remi repository)

sudo yum install php81-php-zip -y

For PHP 8.2 (using Remi repository)

sudo yum install php82-php-zip -y

For systems without Remi repository, try the generic package (usually for default PHP version):

sudo yum install php-zip -y
Linux VDS
High performance for your projects
  • Root access and flexible setup
  • Control panel
  • NVMe disks
  • DDR5
Linux VDS

4. Install ZIP Extension on cPanel/WHM Servers

If you're using cPanel/WHM, install the ZIP extension via EasyApache 4:

  1. Log into WHM (WebHost Manager).
  2. Navigate to EasyApache 4.
  3. Click Customize next to your current PHP profile.
  4. Go to the PHP Extensions section.
  5. Search for "zip" in the search box.
  6. Enable the ZIP extension for your PHP version (toggle it on).
  7. Click Review and then Provision to apply the changes.

Once installed via EasyApache 4, restart Apache:

sudo systemctl restart httpd

Alternatively, you can use cPanel's PHP Pecl Manager or command line if you have terminal access to the server.

5. Enable ZIP Extension in PHP Configuration

If ZIP is installed but still not working, you may need to enable it in your PHP configuration file.

Locate Your php.ini File

Find which configuration file PHP is using:

php --ini | grep "Loaded Configuration File"

Example Output:

Loaded Configuration File: /etc/php/7.4/apache2/php.ini

Important: Your web server (Apache/Nginx) might use a different php.ini than the command line. Check your web server configuration or look for additional php.ini files:

sudo find /etc -name "php.ini" | grep -E "(apache2|fpm|httpd)"

Edit the php.ini File

# For Apache on Ubuntu/Debian
sudo nano /etc/php/7.4/apache2/php.ini

# For PHP-FPM (Nginx) on Ubuntu/Debian
sudo nano /etc/php/7.4/fpm/php.ini

# For CentOS/RHEL (common locations)
sudo nano /etc/php.ini
sudo nano /etc/php.d/zip.ini  # Sometimes extensions have separate files

Enable the ZIP Extension

Search for the ZIP extension line (Ctrl+W, type "zip"):

;extension=zip

Remove the semicolon (;) at the beginning to uncomment it:

extension=zip

If the line doesn't exist, add it in the extensions section. Save the file (Ctrl+O, Enter, Ctrl+X).

6. Restart Apache or PHP-FPM

Configuration changes require a service restart to take effect.

Restart Commands

# For Apache on Ubuntu/Debian
sudo systemctl restart apache2

# For Apache on CentOS/RHEL
sudo systemctl restart httpd

# For Nginx with PHP-FPM
sudo systemctl restart php7.4-fpm  # Adjust version
sudo systemctl restart nginx

# For cPanel servers
sudo systemctl restart httpd

7. Verify That ZIP Is Installed

After installation and restart, verify the extension is active.

# Check command-line PHP
php -m | grep zip

# Check via PHP script (web server)
echo "<?php echo extension_loaded('zip') ? 'ZIP: OK' : 'ZIP: FAILED'; ?>" | sudo tee /var/www/html/check_zip.php

Visit http://yourdomain.com/check_zip.php. It should display "ZIP: OK".

Cleanup: Remove test files after verification:
sudo rm /var/www/html/check_zip.php

If ZIP still doesn't appear, check your web server error logs:

# Apache logs
sudo tail -f /var/log/apache2/error.log

# PHP-FPM logs
sudo tail -f /var/log/php7.4-fpm.log

8. Summary of Fixes

Issue Fix
ZIP extension missing on Ubuntu/Debian sudo apt install php7.4-zip (adjust version)
ZIP extension missing on CentOS/RHEL sudo yum install php74-php-zip (adjust version, Remi repo)
ZIP extension missing on cPanel/WHM Enable via EasyApache 4 > PHP Extensions
ZIP installed but not enabled Uncomment extension=zip in correct php.ini
Changes not applied after configuration Restart Apache/PHP-FPM service
Wrong PHP version package installed Verify PHP version with php -v and install matching package

Following these OS-specific and PHP version-specific instructions will resolve the "ZIP extension needs to be loaded" error in OpenCart!

Frequently asked questions
Debian/Ubuntu (apt): `php-zip` (default PHP) or `php8.1-zip` (Ondrej PPA). RHEL/CentOS/AlmaLinux (yum/dnf): `php-pecl-zip` or via Remi repo `phpXX-php-zip`. Arch: `php-zip` (Arch's split php packages). cPanel: "Select PHP Version" → Extensions → tick `zip`. Always match the PHP version your web SAPI runs.
For the version your web SAPI uses. cPanel: "Select PHP Version" shows what's active for the account. systemd-based: `systemctl status php*-fpm` shows what's running. Install `php-zip` matching that. Then restart that specific php-fpm pool, not all of them.
Distros where official package isn't available (mostly minimal/embedded Linuxes). PECL needs build tools: `apt install php-pear php-dev libzip-dev build-essential`. Then `pecl install zip`. Slower install but works anywhere. Prefer distro package when available — better update support.
`php -m | grep -i zip` (CLI). For PHP-FPM: drop a phpinfo() page and search for "zip" section — should appear. `php -r 'echo class_exists("ZipArchive") ? "yes" : "no";'`. If yes, OpenCart's Extension Installer should now work.
Related articles
Fix "ZIP Extension Needs to Be Loaded" in OpenCart
Install ImageMagick or GD — Server Administrator's Guide
Solving vqmod::bootup Error — "PHP domdocument Extension Required"