Although ZIP archives are widely used offline and online, WordPress may not support them from the get-go. To be more specific, the PHP version on your webserver may or may not support the module, conveniently called “ZipArchive”. Even if it’s uploaded, as this topic suggests, it can be disabled by default for security and other reasons. The situation is largely dependent on the webserver owner i.e., whether it’s a web hosting provider or locally hosted, and the versions of PHP and WordPress itself. With those facts in hand, it’s time to move on to how to enable ZIP archive in WordPress.
How does the error look?
If you stumbled upon our article instead of directly searching for it, it may be because something sounded familiar to you. Don’t worry, you aren’t the first. Here are three quick examples (as well as use cases) where the error frequently appears:
- Slider plugins: Error: Wrong export slider file format! This could be caused because the ZipArchive extension is not enabled.
- Page builder plugins: It seems that you have a problem with your server configuration that might affect <page builder plugin name>. For more details, please visit the system status page.
- General: PHP Fatal error: Uncaught Error: Class ‘ZipArchive’ not found.
1. Enable Zip Archive in WordPress by updating your PHP
Since ZipArchive is a module or an extension for PHP, you might simply need to enable it. You don’t necessarily need to upload to a newer version permanently, although that’s favorable. Instead, you may update the settings on the current one. Follow these steps to enable Zip Archive on the PHP version your WordPress uses:
Check if ZipArchive is turned on via php.ini (Optional)
This step will tell you whether the Zip Archive is even turned on. However, the next step below is far shorter and will solve the issue regardless. Therefore, only follow this step if you’re worried about upgrading PHP. Or, perhaps, if you think something else, such as a plugin, is the culprit, and you want to eliminate PHP from the list of suspects. With all that said, follow the steps outlined in method 1 of our guide on fixing the “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” error.
The only difference is that, when you reach step 6, you shouldn’t look for the “Core” section. Instead, navigate to the section (heading) titled Configuration. Having found that, search for a sub-headling titled zip. It should have rows such as:
- Zip: enabled
- Extension Version/Zip version: 1.15.5
- Libzip headers version: 1.5.1
- Libzip library version: 1.51.
If you cannot find the section, it means that the ZipArchive class is disabled. Thus, PHP cannot find the eponymous class. Move on to the next step.
Switch to a newer version of PHP
We already explained how to update PHP in WordPress. This time around, we’d like to focus on the part about using cPanel or an alternative your web hosting may use, more precisely, step 3. Since a plethora of web hosting providers utilizes a typical Linux cPanel, we’ll sub-method 3 (“A2 Hosting”) to demonstrate:
- Follow steps 1 through 3.
- Put a checkmark in front of the extension name as in step 4, in this case, ‘zip’.
- Click on Save.
Once you see changes take place, you can stop. But if your plugins and themes don’t support the newer PHP version, you can simply repeat steps 1-3, ensure there’s a checkmark in front of ‘zip’, and select the previous one. As always, make sure you have a backup of your WordPress website handy before you try this.
2. Enable Zip Archive module manually via command-line interface (CLI)
If you don’t have cPanel installed but have SSL (Secure Shell) or direct access to your server (such as in localhost), you can also do things manually. Here’s how that works:
- Open your CLI or console.
- Run the following command to see a list of compiled modules PHP uses:
- Tip. If it’s located in the root, you may only need to type php -m
- The list may be too massive to sift through manually. If you’re struggling to locate it, you may filter it via a grep command:
php -m | grep -i zip
Zip Archive doesn’t appear on the list. What now?
If it isn’t on the list, you need to install it manually. Before you do, here are a few useful commands you can run in preparation:
- php -v – Check the current version of PHP (the number between “PHP” and “(cli) (built: date and time)”.
- apt-get update – Download the latest packages for your vesion of PHP.
- php –ini – If your php.ini file is in a custom location, you may need to find where.
- service apache2 restart/service httpd restart or service nginx restart – You must restart your Apache or NGINX webserver for the updated configuration file (php.ini) to load.
Install Zip Archive
Now for the main show. Follow these instructions to enable Zip Archive extension/module/library within PHP:
- Windows – This should not be a problem for you. ZipArchive is enabled by default in WordPress 5.3 and later versions on Windows.
- Linux (Ubuntu and many others) – Type this into the Terminal: sudo apt-get install -y php-zip
- Docker: You can run this command: apt-get install -y libzip-dev zip && docker-php-ext-install zip
- CentOS: Type something akin to this: yum install php7.4-php-pecl-zip.x86_64
Things to note
Here are 3 things to keep in mind:
- Linux: You might have to specify a PHP version for Linux, hence we mentioned it. For example, type apt-get install php7.4-zip.
- Docker: Doing the above in Docker leads to this error: “Unable to locate package php7.4-zip”. Thus, only use the command above. Additionally, if you get an error “Package ‘php-zip’ has no installation candidate”, don’t fret. This means you tried to install a Debian PHP package, such as by typing apt-get install php-zip. Again, use the aforementioned Docker command.
- CentOS: You probably have to enable it by typing: echo “extension=zip.so” >> /data/path/to/php/zip.ini such as echo “extension=zip.so” >> /etc/php.d/zip.ini
3. Contact your web hosting provider or plugin developer
We mentioned that web hosting providers may disable PHP support for Zip Archive libraries by default. Well, they can also prevent you from enabling it manually and require you to reach out via live chat or internal ticket system instead. Similarly, you may solve the problem but an installed WordPress plugin may conflict with your WordPress or PHP version.