Are you looking to enable PHP zip extension in cPanel? We can help you.
PHP websites using zip files needs zip extensions for data processing.
At Bobcares, we receive requests to enable PHP zip extensions as a part of our Server Management Services.
Today, let’s see how our Support Engineers enable PHP zip extension in cPanel.
Why do we need the PHP zip extension?
Website owners always look for ways to optimize website files. Zipping is one way to reduce file size.
A zip archive file format supports lossless data compression, thereby making it suitable for sending and storing data.
If websites use a zip file format, it needs a zip extension to process it. That is, zip extension allows the users to read and write into the zip files.
Now, let’s see how our Support Engineers enable PHP zip extensions in cPanel.
How to enable the PHP zip extension in cPanel?
1. Firstly, we log into cPanel and click on the PHP PEAR Packages available under the SOFTWARE section. The icon appears as in the image.
2. Then we type zip in the search bar, and Archive_Zip will be available. Here, we click on the install icon.
3. After installing Archive_Zip, we go to the previous step and click the Select PHP Version icon.
4. Now, the Archive_Zip is visible here. Click the checkbox of the zip extension. And hit the save button to add the Archive_Zip to the current PHP version. This would install the PHP Zip extension.
How to enable PHP zip extension in WHM?
Zip extension is a very basic requirement for websites nowadays. So we enable it in all the servers we manage. Let’s see how we enable it via WHM.
Initially, we login to WHM and navigate as follows,
Software >> EasyApache 4 >> Customize >> PHP extensions. Here we search for zip and enable phpx.x-php-zip for all versions. Finally, we click on Review and Provision.
This enables the zip extension for all the PHP websites in the server.
Common errors while enabling PHP Zip extension
Now, let’s see a few common errors our customers reported to us while enabling the PHP zip extension.
1. Missing library
Recently, one of our customers approached us with the below error message
PHP ZipArchive Library is missing or disabled
Our Support Engineers checked the current PHP version using the command,
php -v
He used CentOS 6 with Apache and PHP 7.0. The PHP 7 provides a php7.0-zip package. We installed it using the command,
yum install php7.0-zip
We used the below command to check the libraries,
yum list installed | grep -i php
Lastly, we ran the below command to restart Apache,
service httpd restart
Finally, this fixed the error.
2. Installation command error
The PHP zip extensions can be enabled through commands as well. So, few customers try to install it via commands itself. But mistakes in the command lead to errors.
Here is an example where the customer experienced an error due to incorrect command.
The customer received the error Class ZipExtension not found
. He was using CentOS 7 and PHP 7.0.27.
Our Support Engineers checked the command he used. The command was,
yum install php70-php-pecl-zip
The actual package was php-pecl-zip.x86_64. So we installed it using the command,
yum install php70-php-pecl-zip.x86_64
And then, we enabled it by running the command,
echo "extension=zip.so" >> /etc/php.d/zip.ini
This fixed the error and the PHP extension was enabled.
[Need assistance in enabling the PHP extension? – We’ll help you.]
Conclusion
In short, PHP websites using zip files require zip extensions for data processing. Today, we saw how our Support Engineers enabled PHP zip extension in cPanel.
Thanks for the easy instruction. I easily did it!
It is workiing, Great Explaination. Thank you
Hi,
Glad to know that our article helps you solves the issue ? .
Struggling with step 3 and 4 of cpanel as those options are not there.
Hi,
Please contact our support team via live chat(click on the icon at right-bottom)