If you see the error "ZIP extension needs to be loaded for OpenCart to work!", it means the PHP ZIP extension is missing or not enabled. Follow this guide to install the correct ZIP extension for your specific operating system and PHP version.
Check your PHP version with this command:
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
For Ubuntu/Debian systems, use the appropriate package based on your PHP version:
sudo apt update
sudo apt install php7.4-zip -y
sudo apt install php8.0-zip -y
sudo apt install php8.1-zip -y
sudo apt install php8.2-zip -y
sudo apt install php8.3-zip -y
If you're unsure which version-specific package is available, you can search:
apt search php.*-zip
sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum-config-manager --enable remi-php74 # For PHP 7.4
sudo yum install php74-php-zip -y
sudo yum install php80-php-zip -y
sudo yum install php81-php-zip -y
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
If you're using cPanel/WHM, install the ZIP extension via EasyApache 4:
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.
If ZIP is installed but still not working, you may need to enable it in your PHP configuration 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)"
# 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
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).
Configuration changes require a service restart to take effect.
# 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
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
| 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!