If PHP reports Class ZipArchive not found, Composer says the ZIP extension is missing, or a ZIP-related call fails, fix the PHP runtime that is actually executing the command or serving the request. Find that runtime’s active php.ini, install or enable ZIP for its PHP version and build, restart the relevant service, and verify that both the ZIP module and ZipArchive class are available.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
CLI PHP, Apache, PHP-FPM, containers and hosted control panels can use different PHP binaries and configuration files. A successful php -m check therefore does not prove that a website has ZIP enabled.
As an Amazon Associate I earn from qualifying purchases.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →What the ZipArchive error means
PHP’s ZIP extension provides transparent reading and writing of ZIP archives and exposes the ZipArchive class. Errors such as Class ZipArchive not found, Call to undefined method for a ZIP operation, or Composer’s warning that the ZIP extension is missing mean that the PHP process running the application cannot use that extension.
The cause is usually one of four conditions:
- ZIP is not installed for the PHP build.
- ZIP is installed but not enabled in the active
php.ini. - The extension cannot load because its directory, dependent libraries or build type do not match PHP.
- You enabled ZIP for CLI PHP while the website runs a different web-server PHP runtime.
On PHP for Windows, the change in PHP 8.2 is especially important: php_zip.dll must be enabled in php.ini; before PHP 8.2, ZIP was built in and did not require this explicit step.
#1 Best Overall
- 1.1 GHz (boost up to 2.4GHz) Intel Celeron N5030 Quad-Core
Identify the PHP runtime that fails
Do this before installing anything. Run diagnostics in the same context as the failure: a terminal for a CLI command, a temporary diagnostic page for a website, the PHP-FPM pool used by the site, or the container in which the application runs.
CLI diagnostics
- Check the binary and version:
php -v - Display the configuration files PHP is using:
php --iniRecord the “Loaded Configuration File” path. If it says no configuration file, PHP is running with defaults or an explicitly supplied configuration.
- Check whether ZIP is listed among loaded modules:
php -mOn systems with many modules, filter the output with the shell tools available on that system.
- Ask PHP directly about the class and build details:
php -r "var_dump(PHP_SAPI, PHP_VERSION, PHP_OS_FAMILY, PHP_INT_SIZE, PHP_ZTS, ini_get('extension_dir'), class_exists('ZipArchive'));"A final value of
trueconfirms that the CLI process can instantiate the class.PHP_ZTSdistinguishes a thread-safe build from a non-thread-safe build, andPHP_INT_SIZEhelps reveal a 32-bit versus 64-bit mismatch.
Web-server diagnostics
Create a temporary file in the document root containing:
<?php phpinfo();
Open it through the same URL that serves the failing application. Find Loaded Configuration File, extension_dir, the PHP version, architecture and thread-safety/build information, then look for a zip section. Delete the file immediately after checking it; a public phpinfo() page exposes extensive server details.
If the web page shows a different PHP version or configuration path from php --ini, that difference explains why changing the CLI configuration had no effect on the site.
Fix ZIP on Windows
PHP 8.2 and newer
- Find the PHP installation used by the failing process and open the
php.iniidentified byphp --inior the web server’sphpinfo()output. - Confirm that
php_zip.dllexists in the configured extension directory, normally the PHPextfolder. - Enable ZIP in that active configuration. Depending on the PHP package, the directive is commonly
extension=zipor an equivalent DLL directive such asextension=php_zip.dll. Do not enable a file that is absent or belongs to another PHP installation. - Save
php.ini. - Restart the component that loads PHP: Apache, IIS, PHP-FPM, or the relevant development server. Closing and reopening a terminal is also useful after changing the CLI installation.
- Run
php -mfor CLI, or reload the temporaryphpinfo()page for the web runtime. A ZIP section and a successfulclass_exists('ZipArchive')check confirm the change.
The explicit DLL step is required from PHP 8.2 onward because ZIP is no longer automatically available simply because the Windows PHP package is present.
When Windows says it cannot load php_zip.dll
A startup warning such as “Unable to load dynamic library” is not fixed by repeatedly editing the same line. Check the items that determine whether a Windows extension can load:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
- extension_dir: It must point to the directory containing the intended
php_zip.dll, not an older PHP installation. - Dependent DLLs: ZIP and its supporting libraries must be available in locations Windows can load. Read the complete startup warning or PHP error log for the missing filename.
- PHP version: The extension must be built for the same PHP major and minor version as the executable.
- Architecture: A 64-bit PHP process needs a compatible 64-bit extension; a 32-bit process needs the corresponding 32-bit build.
- Thread safety: Thread-safe and non-thread-safe builds are different. Match the extension to the PHP build shown by
phpinfo()orphp -i. - Duplicate installations: PATH order can make
phpin a terminal point to a different directory than the web server’s PHP module.
After correcting one of these conditions, restart PHP and inspect the startup output again. The Windows extension guidance identifies the DLL location, dependent DLLs, extension_dir and compile-time setting mismatches as common causes.
Fix ZIP on Linux
Use a distribution package when possible
Install the ZIP-enabled PHP package that matches the PHP version used by the application. Package names differ between Debian/Ubuntu, DNF-based distributions, Alpine, Arch and other systems, and they also differ when several PHP versions are installed. Select the package from your distribution’s PHP repository rather than copying a command intended for another distribution or version.
After the package installation:
- Run
php --iniandphp -min the CLI environment. - Restart the PHP handler used by the website, such as the appropriate PHP-FPM service or Apache module.
- Reload the application and confirm ZIP in the web runtime’s
phpinfo()output.
Some distributions place module configuration in a directory included by the main php.ini; others use versioned configuration trees. The decisive test is the loaded module list and configuration path of the failing runtime, not the presence of a package alone.
Rank #2
- 256 GB SSD of storage.
- Multitasking is easy with 16GB of RAM
- Equipped with a blazing fast Core i5 2.00 GHz processor.
Compile PHP with ZIP support
If you build PHP from source, configure it with ZIP support:
./configure --with-zip
For PHP 7.4 and later, the build can use a system libzip by specifying its installation directory:
./configure --with-zip --with-libzip=DIR
Replace DIR with the actual libzip prefix on the build host. The PHP build documentation requires libzip 0.11 or newer; version 0.11.2 or later is recommended by the manual. The build needs the development files, not merely a runtime library, so a system that can run an existing ZIP-enabled PHP may still lack what a source build requires.
Once the build is installed, make sure the web server and CLI point to the new PHP installation. Restart the PHP handler, then verify the module in both contexts. If the build reports that libzip is unavailable, install a compatible development package or point --with-libzip to the correct prefix before rebuilding.
PECL and packaged extension builds
The PHP ZIP installation documentation points to PECL as an installation route, and PECL publishes ZIP extension builds for Windows. Use PECL or another packaged build only when it matches the running PHP version, operating-system architecture and thread-safety mode.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchInstalling a matching binary is only part of the process. Enable it in the active configuration, restart the PHP process that will use it, and verify the resulting module list. A PECL extension installed for one PHP executable is invisible to another executable unless that runtime uses the same extension directory and configuration.
Containers, PHP-FPM and deployment pipelines
In a containerized application, install or enable ZIP inside the image that runs PHP. Installing a module on the host does not change an already-built container. Rebuild the image after changing its PHP packages or configuration, restart the container, and run the diagnostic commands inside it.
PHP-FPM workers read configuration when they start. Editing a mounted php.ini without restarting the pool leaves existing workers unchanged. Restart the specific FPM service or deployment that owns the site, then inspect the site through HTTP rather than relying only on a shell inside another container.
For automated deployments, include a verification step such as:
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Rank #3
- 14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
php -r "if (!class_exists('ZipArchive')) { fwrite(STDERR, 'ZipArchive is unavailable'.PHP_EOL); exit(1); }"
This causes a build or release to fail before an application reaches production without the required class.
Managed and shared hosting
On managed hosting, you may not have permission to edit php.ini, install extensions or restart the PHP handler. Ask the provider or server administrator to enable ZIP for the exact web PHP version assigned to the domain. Include the PHP version, the error text, whether the failure occurs in a web request or a scheduled/CLI task, and the configuration path shown by diagnostics.
If the provider offers multiple PHP versions, changing the domain’s PHP version can change both the active configuration and the available modules. Verify the selected version after any control-panel change. If the account cannot control modules, the practical alternatives are provider-side enablement or a hosting environment where administrators can install the required extension.
Composer: ZIP extension versus unzip or 7z
Composer can use PHP’s ZipArchive class, and it may also use an operating-system archive utility. Therefore a Composer message mentioning both the ZIP extension and unzip/7z can describe two separate capabilities:
- PHP ZIP: The PHP process running Composer must load the ZIP extension. Check it with
php -mandclass_exists('ZipArchive')in that same terminal. - External extractor: The operating system must provide a usable
unzipor7zexecutable if Composer needs an external tool. Installing an external utility does not create the PHP class.
After enabling ZIP or installing the external utility, rerun the exact Composer command. If the command still fails, check which php executable Composer invokes and compare its php --ini output with the configuration you edited. A web server’s PHP settings do not automatically apply to Composer’s CLI process.
Choose the installation method that fits your environment
| Method | Best fit | What you must control | Main pitfall |
|---|---|---|---|
| Distribution package | Standard Linux servers and supported PHP versions | Package repositories and the PHP service | Installing a package for another PHP version or handler |
| Source build | Custom PHP builds or systems without a suitable package | Compiler, development libraries, libzip and installation paths | Having a runtime libzip but not the development files, or forgetting --with-zip |
| PECL or packaged binary | Supported prebuilt extension installations | A matching PHP version, architecture and thread-safety mode | Installing into a different executable’s extension directory |
| Container image | Reproducible application deployments | Dockerfile or image build and container restart | Changing the host while leaving the PHP image unchanged |
| Managed hosting | Accounts without server administration | Provider support or a plan with module control | Enabling ZIP for CLI while the domain uses another web PHP version |
The operating system, PHP version, runtime, installation method and administrative permissions determine whether the remedy is a configuration edit, package installation, source rebuild, image rebuild or provider request. There is no single universal command that is safe across Debian/Ubuntu, DNF-based distributions, Alpine, Arch, macOS and Windows.
Runtime and compatibility checklist
Before declaring the problem fixed, record these values for every context that runs the application:
- PHP major and minor version.
- Operating-system family and process architecture.
- CLI, Apache module, PHP-FPM, container or hosted runtime.
- Loaded configuration file and any additional scanned configuration directory.
extension_dirand the actual location of the ZIP binary.- Thread-safe versus non-thread-safe build status on Windows.
- Whether
zipappears in the loaded module list and whetherclass_exists('ZipArchive')returns true.
Comparing this checklist between CLI and HTTP often exposes the mismatch faster than changing settings repeatedly. If one value differs, apply the repair to that runtime rather than the one that merely happens to be in your shell PATH.
Verify the repair in the original application
- Confirm the module in the relevant runtime:
php -mfor CLI or the web runtime’s temporaryphpinfo()page. - Confirm the class directly with
class_exists('ZipArchive'). - Restart the service or process that loads PHP after every configuration or package change.
- Rerun the command, Composer operation, framework task or HTTP request that originally failed.
- Remove temporary diagnostics and check the PHP error log for startup warnings.
A ZIP entry in CLI output is not sufficient when the website still fails; the web process may use another binary, configuration file, extension directory or PHP-FPM pool.
Rank #4
- 【Efficient Performance】 Powered by Intel Core i3 processor (2 cores, 4 threads, up to 3.4GHz) with 12GB RAM and 256GB SSD. Handles multitasking, office software, online classes, and HD video streaming smoothly. Integrated Intel UHD Graphics 620
- Backlit Keyboard & Complete Package】Comes with a cool backlit keyboard. Comes with awebcam, dual stereo speakers (8Ω/1.0W each), DC charger, and user manual – ready for late-night studying, online classes, video conferencing, and daily productivity
- 【Vibrant Display】 15.6-inch Full HD (1920x1080) anti-glare screen with 16:9 aspect ratio delivers crisp images and vivid colors – perfect for studying, watching lectures, or entertainment. Thin-bezel design maximizes viewing area
- 【Fast Connectivity & Expansion】 Equipped with WiFi 6 (802.11ax) and Bluetooth 5.2 for stable, high-speed wireless. Features 3 x USB 3.0, HDMI 2.1, Type-C (supports PD3.0 fast charging), and a TF card slot expandable up to 2TB – easily connect external monitors, mice, drives, or expand storage for all your files
- 【Long Battery Life & Portable】 Built-in 11.55V 5000mAh/57.75Wh high-capacity battery delivers approximately 7 hours of mixed-use battery life – enough for a full day of classes and assignments. Lightweight at just 1.63kg (3.6 lbs) and 19.5mm thin, plus a compact packing size – easily slips into a backpack for campus, library, or coffee shop
Troubleshooting matrix
| Symptom | Likely cause | Evidence-led action |
|---|---|---|
Class ZipArchive not found |
ZIP is not loaded in the executing runtime. | Identify that runtime’s php.ini, install or enable ZIP, restart it, and verify the class. |
php -m shows zip, but the website fails |
CLI and web PHP use different binaries or configuration files. | Inspect the web runtime with phpinfo(), change its configuration, restart the web handler, and test again. |
Windows warns that php_zip.dll cannot load |
Wrong extension_dir, missing dependency DLL, or PHP architecture/thread-safety/version mismatch. |
Check the DLL path, dependent files, build settings and startup logs. |
| Linux source build says libzip is missing | The compatible libzip development files are unavailable or the build cannot find them. | Install a compatible system libzip development package or provide its prefix with --with-libzip, then rebuild with --with-zip. |
| Shared hosting prevents configuration changes | The account lacks permission to install or enable PHP modules. | Ask the host to enable ZIP for the web PHP version or move to an environment with extension control. |
| Composer still mentions ZIP after a fix | Composer is using another CLI PHP, or it also needs an external extractor. | Check Composer’s PHP executable, verify ZipArchive there, and provide unzip or 7z if required. |
Prevent the problem from returning
- Record the PHP version, architecture, thread-safety mode, extension directory and active configuration for each deployment target.
- Keep CLI, FPM and web-server PHP versions aligned when an application expects the same extensions in every context.
- After PHP upgrades, verify that ZIP remains enabled; Windows PHP 8.2 and newer requires the explicit
php_zip.dllconfiguration. - Add a deployment check for
class_exists('ZipArchive')before running migrations, dependency installation or archive-processing jobs. - Do not leave
phpinfo()or diagnostic scripts publicly accessible.
Frequently Asked Questions
How do I enable ZipArchive in PHP?
Find the php.ini used by the failing runtime, install a ZIP-enabled PHP package or confirm php_zip.dll exists, enable it, restart the PHP handler, and verify both the zip module and ZipArchive class.
Why does php -m show zip while my website says the class is missing?
CLI PHP and web PHP commonly use different binaries, versions or configuration files. Check the website with a temporary phpinfo() page and enable ZIP in that runtime’s active configuration.
Do I need to enable php_zip.dll on every Windows PHP installation?
For PHP 8.2 and newer, enable php_zip.dll in the active php.ini. The extension was built in before PHP 8.2, but separate installations can still have different configurations.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsWhat causes “Unable to load dynamic library php_zip.dll”?
Check extension_dir, missing dependent DLLs, PHP major and minor version, 32-bit versus 64-bit architecture, and thread-safe versus non-thread-safe build matching. Read the startup warning or PHP log for the exact missing file.
What libzip version is required for a source build?
The PHP build documentation requires libzip 0.11 or newer and recommends 0.11.2 or later. Install the development files and configure PHP with --with-zip, adding --with-libzip=DIR when needed.
Why does Composer mention both ZIP and unzip or 7z?
Those are separate capabilities. Composer needs PHP’s ZipArchive class or a usable external extractor, depending on the operation. Check the CLI PHP that Composer invokes and install unzip or 7z separately if required.
Can I fix ZIP on shared hosting without shell access?
Only if the control panel exposes the module setting. Otherwise ask the provider to enable ZIP for the domain’s exact web PHP version or move to a plan where administrators can install extensions.
Free tools Windows power users keep installed
One-click scans. No signup required.
Why does changing php.ini not fix PHP-FPM immediately?
PHP-FPM workers read configuration when they start. Restart the specific FPM pool or deployment, then test through HTTP with the web runtime rather than relying on a shell process.
The Bottom Line
Fix ZipArchive in the runtime that actually fails: identify its PHP binary and active php.ini, install or enable ZIP with a matching build, restart the handler, and verify zip plus class_exists('ZipArchive'). Treat CLI, web-server PHP, FPM, containers and hosted accounts as separate runtimes until proven otherwise.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




