PHP Fatal error: Uncaught Error: Class 'ZipArchive' not found in

拈花ヽ惹草 提交于 2020-02-24 05:13:00

问题


I've been struggling with installing zip extension over PHP for a while now. I keep getting an error message while trying to use ZipArchive:

PHP Fatal error: Uncaught Error: Class 'ZipArchive' not found in '...'

The result of: php -m

[PHP Modules]
calendar
Core
ctype
date
dom
exif
fileinfo`
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

Result of sudo pecl list:

Installed packages, channel pecl.php.net:
=========================================
Package Version State
xdebug  2.5.5   stable
zip     1.15.2  stable

Also, phpinfo produced this result:

It looks like zip is installed correctly.

Is there anything else I'm missing?

Thanks.


回答1:


check namespace, try use ZipArchive or new \ZipArchive. otherwise, provide more info on the error message




回答2:


The secret for PHP 7.2:

sudo service httpd restart
sudo service php-fpm restart


来源:https://stackoverflow.com/questions/48255921/php-fatal-error-uncaught-error-class-ziparchive-not-found-in

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!