Php ini zip extension

Is experiencing an error when I install the demo, "Zip extension missing"

4 Answers

DominicStaff
answered 7 years ago

You can send me username & password of your site for further checking, I will help you resolve it.

Hello
i have the same issue
can you help?

DominicStaff
answered 7 years ago

Hi All,
I have checked your site and see that:
ON YOUR VPS
You will need to make sure the Zip extensions are enabled. Check your php.ini file for the following:

On Windows: extension=php_zip.dll
On MAC and Linux: extension=zip.so

For more details see: http://www.php.net/manual/en/book.zip.php

ON HOSTED SERVERS
Just contact your hosting provider and tell them you want PHP with Zip support so that the "ZipArchive Class" will work. This is a very common feature and is available on almost all shared hosting environments.

Hope this helps!

You have a folder of images of the covers of each post. real images

Please login or Register to submit your answer

Powered by DW Question & Answer Pro

Php ini zip extension
Photo from Unsplash

PHP zip extension is used to read and write compressed zip files. This extension is usually required to make PHP-based applications able to interact with zip files.

Sometimes, you may see the “PHP zip is not installed or has been disabled message” in WordPress.

Here are the steps to enable the PHP zip extension in your hosting from cPanel:

  1. Log into your cPanel account
  2. Go to the Select PHP Version menu
  3. Click the Extensions tab
  4. Check the zip extension to enable it

The tutorial below will show you how to do these steps in detail:

Enable PHP zip in your hosting

Login to your cPanel account, then look for the Select PHP Version menu under the Software tab:

Next, click on the Extensions tab and see the zip extension under the Z entries as shown below:

Click the checkbox beside the zip extension to enable it.

What if you don’t see the zip extension?

If you don’t see the zip extension, then you may need to install it first.

Get back to your cPanel home page, then find the PHP PEAR Packages menu.

It’s also located under the Software tab as shown below:

On the PEAR Packages page, use the search menu to look for the “zip” extension.

You should see the Archive_Zip extension shown in the search result like this:

Click on Install to have the extension installed on your hosting.

Finally, go back to the Select PHP Version menu and check the Extensions tab. You should see the zip extension already checked on this page.

And that’s how you enable PHP zip in your hosting provider. Good work! 👍

Php ini zip extension

tech

How to Install PHP ext-zip extension?

Symptoms

Typical error message, meaning that PHP ext-zip extension is missing:

laravel/installer v2.0.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.

Fix me

First, get PHP version running on your computer:

php --version

Then, on Ubuntu, just run this command:

# For php v7.0
sudo apt-get install php7.0-zip
 
# For php v7.1
sudo apt-get install php7.1-zip
 
# For php v7.2
sudo apt-get install php7.2-zip

On CentOs:

yum install php-pecl-zip

Done! Hope it helps!

Is your PHP saying that it cannot find the ZipArchive class? Then, this post will show you how to enable the ZipArchive module.

Php ini zip extension

You should see the following error:

PHP Fatal error: Uncaught Error: Class 'ZipArchive' not found

Also, below is an example of the code you may be using:

$zip = new \ZipArchive();
$x = $zip->open($target_path);
if ($x === true) {
    $zip->extractTo($target_dir . $name[0]);
    $zip->close();
}

  • What does this error mean?
  • How to enable ZipArchive on Windows
  • Before you enable ZipArchive
  • How to enable ZipArchive on Docker
  • How to enable ZipArchive on Linux on Ubuntu
  • Don’t forget to restart your web server!
  • Wrapping up
  • You may also be interested in

What does this error mean?

This error means that PHP could not find the ZipArchive class. Therefore, PHP needs to have the zip extension installed for the ZipArchive Class to be present.

You can check whether ZipArchive is installed by using a PHP info file.

See an example below:

Your PHP info file should return something like this:

Php ini zip extension

Next, scroll down until you find the heading “Configuration” and then continue until you see the following:

Php ini zip extension

You will know that the ZipArchive class is not enabled if you cannot see: “Zip” configuration “enabled”.

You can also check whether the Zip module is enabled using the CLI.

Show compiled in modules using: php -m.

user@server:/var/www/html# php -m
[PHP Modules]
Core
ctype
date
dom
zip
zlib

[Zend Modules]

As the PHP module list can get quite large, consider using the grep command to filter your list:

Or you can use “php -m” to show the PHP information in the CLI.

How to enable ZipArchive on Windows

Windows users have it easy! You do not need to do anything if you use PHP 5.3 or newer. So, don’t trust that the code written and evaluated on Windows will work on Linux.

As of PHP 5.3, this extension is built-in. Before, Windows users needed to enable php_zip.dll inside of php.ini  to use these functions.

https://www.php.net/manual/en/zip.installation.php

Before you enable ZipArchive

You can enable Zip support during the installation of PHP and after the fact. This post will focus on an after-the-fact ZipArchive installation on Linux. Please read the installing Zip instruction from the PHP manual for more information.

Before you continue, note the following helpful command to get your current version of PHP:

user@server:/var/www/html# php -v
PHP 7.4.2 (cli) (built: Feb  1 2020 19:39:30) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

Note the version in the example above being: 7.4.2. We will, therefore, need to install the Zip module for PHP version 7.4. Please remember to change the version number to match yours if the command requires it!

Also, make sure that your packages are up to date using the “apt-get update” command:

user@server:/var/www/html# apt-get update
Hit:1 http://security.debian.org/debian-security buster/updates InRelease
Hit:2 http://deb.debian.org/debian buster InRelease
Hit:3 http://deb.debian.org/debian buster-updates InRelease
Reading package lists... Done

Lastly, you may need to determine the location of the loaded php.ini file. Please note that the CLI uses its version.

Use the following command to help you:

user@server:/var/www/html# php --ini
Configuration File (php.ini) Path: /usr/local/etc/php
Loaded Configuration File:         /usr/local/etc/php/php.ini
Scan for additional .ini files in: /usr/local/etc/php/conf.d
Additional .ini files parsed:      /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini,
/usr/local/etc/php/conf.d/docker-php-ext-redis.ini,
/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini,
/usr/local/etc/php/conf.d/docker-php-ext-zip.ini

How to enable ZipArchive on Docker

First, run the following command to install Zip and compile PHP correctly to run it.

apt-get install -y libzip-dev zip && docker-php-ext-install zip

Below you will see how to restart Apache or NGINX. Once you install, you have finished.

Note that you will get an “E: Package ‘php-XXX’ has no installation candidate” error if you try to install any of Debian‘s PHP packages. This error is the default intended behavior of the official PHP Docker image.

You can see an example of this behavior below:

user@server:/var/www/html# apt-get install php-zip
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php-zip is a virtual package provided by:
  php7.3-zip 7.3.14-1~deb10u1 [Not candidate version]
  php7.3-zip 7.3.11-1~deb10u1 [Not candidate version]

E: Package 'php-zip' has no installation candidate

You can also get the following error if you specify a specific version.

user@server:/var/www/html# apt-get install php7.0-zip
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.0-zip
E: Couldn't find any package by glob 'php7.0-zip'
E: Couldn't find any package by regex 'php7.0-zip'

How to enable ZipArchive on Linux on Ubuntu

The install PHP Zip command:

sudo apt-get install -y php-zip

The output will result in something like this:

user@server:/home/user# sudo apt-get install php-zip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libzip5 php-common php7.3-common php7.3-zip
The following NEW packages will be installed:
  libzip5 php-common php-zip php7.3-common php7.3-zip
0 to upgrade, 5 to newly install, 0 to remove and 48 not to upgrade.
1 not fully installed or removed.
Need to get 1,003 kB of archives.
After this operation, 7,443 kB of additional disk space will be used.

Please note that you may need to specify the PHP version if you upgraded to a recent version of PHP.

Don’t forget to restart your web server!

The configuration file (php.ini) is only read when PHP or the webserver starts. Equally, the php.ini file is only read at invocation for the CGI and CLI versions.

You can restart Apache using:

Likewise, you can restart NGINX using:

Wrapping up

It is easy to get your website zipping files and avoid a fatal error. I hope that you now know how to enable ZipArchive for PHP. No one likes seeing a “Fatal error: Class’ ZipArchive’ not found in”.

You may also be interested in



About the Authors

Anto's editorial team loves the cloud as much as you! Each member of Anto's editorial team is a Cloud expert in their own right. Anto Online takes great pride in helping fellow Cloud enthusiasts. Let us know if you have an excellent idea for the next topic! Contact Anto Online if you want to contribute.

Support the Cause

Support Anto Online and buy us a coffee. Anything is possible with coffee and code.

Buy me a coffee



What is PHP zip extension?

The PHP Zip files functions are used to stores the bunch of files or directory together in the compressed. The Zip is the archive file format that is used to stores the files in compressed form.

How do you add a ZIP extension?

Install Chrome extension from file Vision RPA Selenium IDE. In the case of Kantu, you can get the older version directly from the archive. So the process starts with the Chrome extension as ZIP archive. Step 2: Select "Load Unpacked" (extension) and point it to the extension folder - and you are done!

How do I fix PHP zip extension is not loaded?

This error indicates an incompatibility with PHP on your server and the latest update to Elementor. To solve it, please ensure the PHP version is 7.4 or 7.5 (not 7.3 or 8) on your server. Additionally, ensure the zip extension for PHP is installed.

How do I enable a zip file extension?

Step 1: Log in to your cPanel. Login to cPanel and go to PHP PEAR Package. Type Zip in the search bar..
Step 2: Install PHP Zip Extension. Now, you will find Archive_Zip. ... .
Step 3: Change the PHP Version and Enable PHP Zip Extension. Change to PHP version to anything that is not native and click on “Set as Current”.