Predefined Constants

The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.

ZipArchive uses class constants. There are three types of constants : Flags (prefixed with FL_), errors (prefixed with ER_) and mode (no prefix).

ZipArchive::CREATE (integer)
Create the archive if it does not exist.
ZipArchive::OVERWRITE (integer)
If archive exists, ignore its current contents. In other words, handle it the same way as an empty archive.
ZipArchive::EXCL (integer)
Error if archive already exists.
ZipArchive::RDONLY (integer)
Open archive in read only mode. Available as of PHP 7.4.3 and PECL zip 1.17.1, respectively, if built against libzip ≥ 1.0.0.
ZipArchive::CHECKCONS (integer)
Perform additional consistency checks on the archive, and error if they fail.
ZipArchive::FL_NOCASE (integer)
Ignore case on name lookup
ZipArchive::FL_NODIR (integer)
Ignore directory component
ZipArchive::FL_COMPRESSED (integer)
Read compressed data
ZipArchive::FL_UNCHANGED (integer)
Use original data, ignoring changes.
ZipArchive::FL_RECOMPRESS (integer)
Force recompression of data. Available as of PHP 8.0.0 and PECL zip 1.18.0.
ZipArchive::FL_ENCRYPTED (integer)
Read encrypted data (implies FL_COMPRESSED). Available as of PHP 8.0.0 and PECL zip 1.18.0.
ZipArchive::FL_OVERWRITE (integer)
If file with name exists, overwrite (replace) it. Available as of PHP 8.0.0 and PECL zip 1.18.0.
ZipArchive::FL_LOCAL (integer)
In local header. Available as of PHP 8.0.0 and PECL zip 1.18.0.
ZipArchive::ZIP_FL_CENTRAL (integer)
In central directory. Available as of PHP 8.0.0 and PECL zip 1.18.0.
ZipArchive::FL_ENC_GUESS (integer)
Guess string encoding (is default). Available as of PHP 7.0.8.
ZipArchive::FL_ENC_RAW (integer)
Get unmodified string. Available as of PHP 7.0.8.
ZipArchive::FL_ENC_STRICT (integer)
Follow specification strictly. Available as of PHP 7.0.8.
ZipArchive::FL_ENC_UTF_8 (integer)
String is UTF-8 encoded. Available as of PHP 7.0.8.
ZipArchive::FL_ENC_CP437 (integer)
String is CP437 encoded. Available as of PHP 7.0.8.
ZipArchive::CM_DEFAULT (integer)
better of deflate or store.
ZipArchive::CM_STORE (integer)
stored (uncompressed).
ZipArchive::CM_SHRINK (integer)
shrunk
ZipArchive::CM_REDUCE_1 (integer)
reduced with factor 1
ZipArchive::CM_REDUCE_2 (integer)
reduced with factor 2
ZipArchive::CM_REDUCE_3 (integer)
reduced with factor 3
ZipArchive::CM_REDUCE_4 (integer)
reduced with factor 4
ZipArchive::CM_IMPLODE (integer)
imploded
ZipArchive::CM_DEFLATE (integer)
deflated
ZipArchive::CM_DEFLATE64 (integer)
deflate64
ZipArchive::CM_PKWARE_IMPLODE (integer)
PKWARE imploding
ZipArchive::CM_BZIP2 (integer)
BZIP2 algorithm
ZipArchive::CM_LZMA (integer)
LZMA algorithm
ZipArchive::CM_LZMA2 (integer)
LZMA2 algorithm. Available as of PHP 7.4.3 and PECL zip 1.16.0, respectively, if built against libzip ≥ 1.6.0.
ZipArchive::CM_ZSTD (integer)
Zstandard algorithm. Available as of PHP 8.0.0 and PECL zip 1.19.1, respectively, if built against libzip ≥ 1.8.0.
ZipArchive::CM_XZ (integer)
XZ algorithm. Available as of PHP 7.4.3 and PECL zip 1.16.1, respectively, if built against libzip ≥ 1.6.0.
ZipArchive::ER_OK (integer)
No error.
ZipArchive::ER_MULTIDISK (integer)
Multi-disk zip archives not supported.
ZipArchive::ER_RENAME (integer)
Renaming temporary file failed.
ZipArchive::ER_CLOSE (integer)
Closing zip archive failed
ZipArchive::ER_SEEK (integer)
Seek error
ZipArchive::ER_READ (integer)
Read error
ZipArchive::ER_WRITE (integer)
Write error
ZipArchive::ER_CRC (integer)
CRC error
ZipArchive::ER_ZIPCLOSED (integer)
Containing zip archive was closed
ZipArchive::ER_NOENT (integer)
No such file.
ZipArchive::ER_EXISTS (integer)
File already exists
ZipArchive::ER_OPEN (integer)
Can't open file
ZipArchive::ER_TMPOPEN (integer)
Failure to create temporary file.
ZipArchive::ER_ZLIB (integer)
Zlib error
ZipArchive::ER_MEMORY (integer)
Memory allocation failure
ZipArchive::ER_CHANGED (string)
Entry has been changed
ZipArchive::ER_COMPNOTSUPP (integer)
Compression method not supported.
ZipArchive::ER_EOF (integer)
Premature EOF
ZipArchive::ER_INVAL (integer)
Invalid argument
ZipArchive::ER_NOZIP (integer)
Not a zip archive
ZipArchive::ER_INTERNAL (integer)
Internal error
ZipArchive::ER_INCONS (integer)
Zip archive inconsistent
ZipArchive::ER_REMOVE (integer)
Can't remove file
ZipArchive::ER_DELETED (integer)
Entry has been deleted
ZipArchive::ER_ENCRNOTSUPP (integer)
Encryption method not supported. Available as of PHP 7.4.3 and PECL zip 1.16.1, respectively.
ZipArchive::ER_RDONLY (integer)
Read-only archive. Available as of PHP 7.4.3 and PECL zip 1.16.1, respectively.
ZipArchive::ER_NOPASSWD (integer)
No password provided. Available as of PHP 7.4.3 and PECL zip 1.16.1, respectively.
ZipArchive::ER_WRONGPASSWD (integer)
Wrong password provided. Available as of PHP 7.4.3 and PECL zip 1.16.1, respectively.
ZipArchive::ZIP_ER_OPNOTSUPP (integer)
Operation not supported. Available as of PHP 7.4.3 and PECL zip 1.16.1, respectively, if built against libzip ≥ 1.0.0.
ZipArchive::ZIP_ER_INUSE (integer)
Resource still in use. Available as of PHP 7.4.3 and PECL zip 1.16.1, respectively, if built against libzip ≥ 1.0.0.
ZipArchive::ZIP_ER_TELL (integer)
Tell error. Available as of PHP 7.4.3 and PECL zip 1.16.1, respectively, if built against libzip ≥ 1.0.0.
ZipArchive::ZIP_ER_COMPRESSED_DATA (integer)
Compressed data invalid. Available as of PHP 7.4.3 and PECL zip 1.16.1, respectively, if built against libzip ≥ 1.6.0.
ZipArchive::ER_CANCELLED (integer)
Operation cancelled. Available as of PHP 7.4.3 and PECL zip 1.16.1, respectively, if built against libzip ≥ 1.6.0.
ZipArchive::EM_NONE (integer)
No encryption. Available as of PHP 7.2.0 and PECL zip 1.14.0, respectively.
ZipArchive::EM_TRAD_PKWARE (integer)
Traditional PKWARE encryption. Available as of PHP 8.0.0 and PECL zip 1.19.0, respectively.
ZipArchive::EM_AES_128 (integer)
AES 128 encryption. Available as of PHP 7.2.0 and PECL zip 1.14.0, respectively, if built against libzip ≥ 1.2.0.
ZipArchive::EM_AES_192 (integer)
AES 192 encryption. Available as of PHP 7.2.0 and PECL zip 1.14.0, respectively, if built against libzip ≥ 1.2.0.
ZipArchive::EM_AES_256 (integer)
AES 256 encryption. Available as of PHP 7.2.0 and PECL zip 1.14.0, respectively, if built against libzip ≥ 1.2.0.
ZipArchive::EM_UNKNOWN (integer)
Unknown encryption algorithm. Available as of PHP 8.0.0 and PECL zip 1.19.0, respectively.
ZipArchive::LIBZIP_VERSION (string)
Zip library version. Available as of PHP 7.4.3 and PECL zip 1.16.0.
Operating system constants for external attributes
ZipArchive::OPSYS_DOS (integer)
ZipArchive::OPSYS_AMIGA (integer)
ZipArchive::OPSYS_OPENVMS (integer)
ZipArchive::OPSYS_UNIX (integer)
ZipArchive::OPSYS_VM_CMS (integer)
ZipArchive::OPSYS_ATARI_ST (integer)
ZipArchive::OPSYS_OS_2 (integer)
ZipArchive::OPSYS_MACINTOSH (integer)
ZipArchive::OPSYS_Z_SYSTEM (integer)
ZipArchive::OPSYS_CPM (integer)
ZipArchive::OPSYS_WINDOWS_NTFS (integer)
ZipArchive::OPSYS_MVS (integer)
ZipArchive::OPSYS_VSE (integer)
ZipArchive::OPSYS_ACORN_RISC (integer)
ZipArchive::OPSYS_VFAT (integer)
ZipArchive::OPSYS_ALTERNATE_MVS (integer)
ZipArchive::OPSYS_BEOS (integer)
ZipArchive::OPSYS_TANDEM (integer)
ZipArchive::OPSYS_OS_400 (integer)
ZipArchive::OPSYS_OS_X (integer)
ZipArchive::OPSYS_DEFAULT (integer)
Since PHP 5.6.0, PECL zip 1.12.4