Fatal error Class ' ziparchive ' not found ... The solution

Source: Internet
Author: User
Tags php ziparchive zip extension ziparchive
PHP ziparchive is a PHP extension class, you can easily achieve the zip file compression and decompression, the use of the class before you need to ensure that the PHP ZIP extension is open, if you do not open the class to use directly, the program will report the Fatal error class ' Ziparchive ' not found ... This error, the following article on this error sharing the solution.

The first thing we need to know is that this error indicates that the program did not succeed when it called the ' ziparchive ' class because it did not add PHP zip support (not zlib) when installing PHP.

Then the process steps are as follows:

(1) Check if the Ext folder in the PHP installation folder has php_zip.dll this file

(2) To ensure that the above documents exist under the premise, modify the php.ini file, remove Extension=php_zip.dll front ";", open ziparchive Extension

(3) Restart Apache to

The following separately describes the Windows system and Linux system respectively

Specific steps

Windows system

1, in the php.ini file, will extension=php_zip.dll the front semicolon ";" Remove, and then also in the php.ini file, change zlib.output_compression = Off to zlib.output_compression = On

2. Restart Apache Server

Unix/linux system

1, there is no php_zip.dll this file under Linux (and will not work), so you need to recompile the PHP zip module.

The specific installation method is as follows:

Cd/usr/src

wget Http://pecl.php.net/get/zip
TAR-ZXVF zip
CD zip-1.x.x
Phpize
./configure
Make

sudo make instal

In the final use of the Make install command, you may need to use root permissions, so it is recommended to use sudo to run. After installation, you will be prompted for the zip.so location on the screen.

It is then recorded, such as:/usr/local/lib/php/extensions/zip.so.

2, the use of root permissions to modify php.ini (usually may be in the/usr/local/lib/folder, but depending on the original installation of PHP, can be viewed through phpinfo ()): Increase extension =/usr/local/lib/php/ Extensions/zip.so, and then also in the php.ini file, change zlib.output_compression = Off to zlib.output_compression = on;

3. Don't forget to restart Apache at the end:

Apachectl Restart;

This zip module for PHP is installed on the completion of the above processing, your server should be able to directly run ziparchive this class.

The above solutions if there are doubts and errors, welcome message correction.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.