Fatal error: Class 'ZipArchive' not found in

后端 未结 20 1313
既然无缘
既然无缘 2020-11-27 03:39

I have a problem that I install \'Archive_Zip 0.1.1\' on Linux server, but when I try to run the script to create the zip file it gives the fatal error

<
相关标签:
20条回答
  • PHP 5.2.0 and later

    Linux systems

    In order to use these functions you must compile PHP with zip support by using the --enable-zip configure option.

    Windows

    Windows users need to enable php_zip.dll inside of php.ini in order to use these functions.

    0 讨论(0)
  • 2020-11-27 03:56

    For Centos 7 and PHP 7.3 on Remi

    Search for the zip extension:

    $ yum search php73 | grep zip
    php73-php-pecl-zip.x86_64 : A ZIP archive management extension
    

    The extension name is php73-php-pecl-zip.x86_64. To install it in server running single version of PHP, remove the prefix php73:

    $ sudo yum --enablerepo=remi-php73 install php-pecl-zip #for server running single PHP7.3 version
    $ #sudo yum --enablerepo=remi-php73 install php73-php-pecl-zip # for server running multiple PHP versions
    

    Restart PHP:

    $ sudo systemctl restart php-fpm
    

    Check installed PHP extensions:

    $ php -m
    [PHP Modules]
    apcu
    bcmath
    bz2
    ...
    zip
    zlib
    
    0 讨论(0)
  • 2020-11-27 03:57

    For me work, first review

       php -m
       php -version
    

    Later install the extension

    apt-get update 
    apt-get install php7.2-zip
    systemctl restart apache2
    
    0 讨论(0)
  • 2020-11-27 03:58

    If you have WHM available it is easier.

    Log in to WHM.

    Go to EasyApache 4 (or whatever version u have) under Software tab.

    Under Currently Installed Packages click Customize.

    Go to PHP Extensions, in search type "zip" (without quotes),

    you should see 3 modules

    check all of them,

    click blue button few times to finish the process.

    This worked for me. Thankfully I've WHM available.

    0 讨论(0)
  • 2020-11-27 04:01

    I had the same issue and it had solved using two command lines:

    sudo apt install php-zip

    then reboot your web server, for Apache

    sudo service apache2 restart

    0 讨论(0)
  • 2020-11-27 04:02

    For CentOS based server use

    yum install php-pecl-zip.x86_64
    

    Enable it by running: echo "extension=zip.so" >> /etc/php.d/zip.ini

    0 讨论(0)
提交回复
热议问题