PHP Zip in cPanel

AiroServer's Blog

PHP Zip in cPanel

PHP websites that use zip files need the PHP zip extension to process the data. To enable PHP Zip in cPanel, website owners can follow a few simple steps.

Why do we need a PHP zip extension?

Website owners are always looking for ways to optimize website files. Compression is one of the ways to reduce file size.

The zip archive file format supports lossless data compression, making it suitable for sending and storing data.

Websites that use the compressed file format need the zip extension to process it. The zip extension allows users to read and write compressed files.

How to enable PHP extension in cPanel?

1.First, we enter cPanel and click on the PHP PEAR packages  in the SOFTWARE section. The icon will appear as shown.

php zip in cPanel2.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, go to the previous step and click on the Select PHP Version icon.

4.Now, Archive_Zip can be seen here. Click the zip plugin checkbox and hit the save button to add Archive_Zip to the current PHP version. This will install the PHP Zip extension.

How to enable PHP extension in WHM?

Zip plugin is a very basic requirement for websites today. So we enable it on all the servers we manage. Let’s see how to enable it through WHM.

First, we enter WHM and move 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 plugin enables zip for all PHP websites on the server.

Common errors when enabling the PHP Zip extension

Now, let’s see some common errors reported when enabling a PHP extension:

  1. The library is missing.

Common errors:

PHP ZipArchive Library is missing or disabled

You can check this using the following command:

php -v

He is using CentOS 6 with Apache and PHP 7.0. PHP 7 provides a php7.0-zip package. We installed it using the command:

yum install php7.0-zip

We use the following command to check the libraries:

yum list installed | grep -i php

Finally, we ran the following command to restart Apache.

service httpd restart

Finally, this error will be fixed.

php zip in cPanel

  1. Installation command error

PHP extensions can also be enabled via commands. Therefore, few users try to install it through the commands themselves. But mistakes in the command lead to errors.

Here is an example where the user got an error due to an incorrect command.

Got a ZipExtension class not found error. He is using CentOS 7 and PHP 7.0.27.

yum install php70-php-pecl-zip

The actual package was php-pecl-zip.x86_64. So we install it using the command:

Install yum php70-php-pecl-zip.x86_64.

And then we activate it by executing the command:

echo “extension=zip.so” >> /etc/php.d/zip.ini

This error is fixed and the PHP extension is enabled.

Find More Articles...

Whats New?

fa_IRFA