Zip file is a ubiquitous file type that allows users to compress files and transfer a lot of files at once with ease. This file type is supported by virtually all operating systems.
The versatility of Zip file is also used by web developers, who often upload and download a large number of small files. By compressing the files to a single Zip file, web developers could save a lot of time. Thus, support for Zip files in modern servers is expected by web developers.
However, Zip file support sometimes needs to be enabled or installed by the web hosting owners. For example, out of the box, servers powered by the popular cPanel web hosting control panel did not come with PHP Zip extension enabled. This can confuse webmasters trying to incorporate Zip files in their workflow.
Fortunately, installing Zip file support in cPanel is easy to do. While it should be done by the server owner/administrator, the feature can be installed easily in only a few minutes. If you are a server administrator looking to install PHP Zip extension in your cPanel-powered server, you are in the right place. Read on to know-how.
Table of Contents
Installing PHP Zip Extension in Your cPanel-Powered Hosting
The first step is to visit your cPanel control panel. Then, afterward, you can click on “PHP PEAR Packages” menu under the “Software” section. The page with all available PEAR packages will appear on your screen. Type “zip” in the search bar, and click the “Install” icon next to the “Archive_Zip” entry.
When the install process is finished (it should not take more than a few seconds), go back to the cPanel home page and click “Select PHP version”. The Zip package will be shown, and you just need to click the checkbox to install it. Afterward, the Zip extension is ready to use in the specific website.
Installing Zip Extension Server-Wide via WHM
If you want to enable the Zip file support server-wide, you can do so through WHM interface. WHM (Web Host Manager) is a server management tool usually available for cPanel server administrators. With WHM, the provision of new features and capabilities can be set server-wide. To enable Zip support through WHM, follow these steps.
- First, you need to log in to your WHM instance. Then, select “Software”, and choose “EasyApache 4”. After the page loads, choose “Customize”, then “PHP Extensions”. Find the word “zip” in the page, and enable phpx-x-php-zip for all PHP versions available on the server.
- Then, click on “Review”, and finally, click “Provision”. The Zip file support is now enabled for all websites hosted in the same server, regardless of the cPanel settings on every particular site.
Know Errors When Installing Zip Extension
However, sometimes installation through the web interface would trigger the error “PHP ZipArchive Library is missing or disabled”. In that case, you can follow these steps.
First, log in to your server through SSH. You can use any SSH programs you like, such as PuTTY in Windows or Terminal in Linux or Mac. Then, issue the following commands as root:
This command shows the current PHP version installed on the machine.
yum install phpx.x-zip
Replace the phpx.x with the PHP version the server is running. For example, if the website is running PHP version 7, the command will be “yum install php7.0-zip”
yum list installed | grep -I php
This command will show PHP extensions that are installed on your server. Ensure that the zip entry is listed.
service httpd restart
After installing the PHP Zip package, you need to restart the HTTPD/Apache service for it to work. Issue the command above to trigger Apache restart without rebooting the entire server.