PHP Zip File Functions

PHP Zip File Introduction

Compression file functions allow us to read compressed files.

Installation

To run the Zip File function on the server, you must install these libraries:

Installation on Linux system

PHP 5+:The Zip functions and Zip library are not enabled by default, you must download them from the above link. Please use --with-zip=DIR Configuration options to include Zip support.

Installation on Windows system

PHP 5+:The Zip functions are not enabled by default, and you must download php_zip.dll and ZZIPlib library from the link above. php_zip.dll must be enabled within php.ini.

To enable any PHP extension, the PHP extension_dir setting (in the php.ini file) should be set to the directory where the PHP extension is located. For example, the value of extension_dir may be c:\php\ext.

PHP Zip File Functions

PHP:Indicates the earliest PHP version that supports this function.

Function Description PHP
zip_close() Close the ZIP file. 4
zip_entry_close() Close an item in the ZIP file. 4
zip_entry_compressedsize() Return the compressed size of an item in the ZIP file. 4
zip_entry_compressionmethod() Return the compression method of an item in the ZIP file. 4
zip_entry_filesize() Return the actual file size of an item in the ZIP file. 4
zip_entry_name() Return the name of an item in the ZIP file. 4
zip_entry_open() Open an item in the ZIP file for reading. 4
zip_entry_read() Read an open item in the ZIP file. 4
zip_open() Open a ZIP file. 4
zip_read() Read the next item in the ZIP file. 4

PHP Zip File Constants

None.