Install ZIP Extension for OpenCart Based on OS & PHP Version
1. Identify Your PHP Version
Check your PHP version with this command:
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
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
4. Install ZIP Extension on cPanel/WHM Servers
If you're using cPanel/WHM, install the ZIP extension via EasyApache 4:
- Log into WHM (WebHost Manager).
- Navigate to EasyApache 4.
- Click Customize next to your current PHP profile.
- Go to the PHP Extensions section.
- Search for "zip" in the search box.
- Enable the ZIP extension for your PHP version (toggle it on).
- 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".
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!


