PHP using ziparchive hint fatal Error:class ziparchive not found in solution, ziparchivefatal_php tutorial

Source: Internet
Author: User
Tags ziparchive

PHP uses ziparchive hint fatal Error:class ziparchive not found in solution, ziparchivefatal


The example in this article describes the workaround for PHP using ziparchive hint fatal Error:class ziparchive not found in. Share to everyone for your reference. Specific as follows:

Ziparchive is a compression and decompression function that comes with PHP, and it's natural to use the new ziparchive to create a zip file in the case of a hint fatal error:class ziparchive not found in error, Interested friends will come together to see the solution.

The test code is as follows:

Copy the Code code as follows://php extract file (Zip)
function Unzip_file ($file, $destination) {
$zip = new Ziparchive ();
Open compressed file
if ($zip->open ($file)!== TRUE) {
Die (' Could not open archive ');
}
Create a file
$zip->extractto ($destination);
$zip->close ();
echo ' success ';
}
Unzip_file ("Htdocs.zip", "wenjianming");

Found at execution time
Fatal error:class ' ziparchive ' not found in e:wwwqqdown.php on line 63
See this is not undefined, so the small part Baidu search, as follows the following explanation

The solution under Windows is:

1, in the php.ini file, will extension=php_zip.dll the front semicolon ";" Removal
Restart the Apache server, and we'll try to find out.

Add:

If it is a Linux system, refer to the following method

There is no php_zip.dll this file under Linux
A php zip module needs to be recompiled. The specific installation method is as follows:

Copy the Code code 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 install
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 ()):
Add 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, finally do not forget to restart the apache:apachectl restart;

Note: Some friends about the website said zlib.output_compression = Off changed to Zlib.output_compression = on; I didn't see anything under windows in the php.ini file, but it was really possible to generate or unzip the file.

I hope this article is helpful to everyone's PHP programming.


Php:class ' ziparchive ' not found in

Remove the semicolon in front of the php.ini; Extension=php_zip.dll. If you install PHP inside the Ext folder has Php_zip.dll

Php:class ' ziparchive ' not found in

The Php_zip.dll not exist,you should find Php_zip.dll file in your computer for my mind:

http://www.bkjia.com/PHPjc/906117.html www.bkjia.com true http://www.bkjia.com/PHPjc/906117.html techarticle PHP uses ziparchive hint fatal Error:class ziparchive not found in solution, ziparchivefatal This example tells the PHP use ziparchive hint fatal Error:class ziparchive not ...

  • 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.