Home >Backend Development >PHP Tutorial >Why Am I Getting a \'Class \'ZipArchive\' Not Found\' Error After Installing Archive_Zip on My Linux Server?

Why Am I Getting a \'Class \'ZipArchive\' Not Found\' Error After Installing Archive_Zip on My Linux Server?

Patricia Arquette
Patricia ArquetteOriginal
2024-11-26 00:40:11582browse

Why Am I Getting a

Class 'ZipArchive' Not Found Error While Installing Archive_Zip on Linux Server

Symptom:

When attempting to run a script that utilizes the ZipArchive class after installing Archive_Zip 0.1.1 on a Linux server, users may encounter the following fatal error:

Fatal error: Class ZipArchive not found in ...

Cause:

This error occurs because the ZipArchive class requires the PHP zip extension to be present.

Resolution:

To resolve this issue, follow these steps:

1. Install the PHP Zip Extension:

  • Debian/Ubuntu:

    sudo apt update
    sudo apt install php-zip
  • Other Linux Distributions:
    Refer to the official PHP documentation for instructions on installing the zip extension.

2. Restart the Web Server:

  • Apache:

    sudo systemctl restart apache2
  • Nginx:

    sudo systemctl restart nginx

Additional Notes:

  • Ensure that the script has proper file permissions.
  • If the error persists, verify that the zip extension is enabled in php.ini.

The above is the detailed content of Why Am I Getting a \'Class \'ZipArchive\' Not Found\' Error After Installing Archive_Zip on My Linux Server?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn