PHP致命错误:未捕获错误:

时间:2018-01-15 01:33:15

标签: php zip ziparchive

我一直在努力在PHP上安装zip扩展一段时间。 尝试使用ZipArchive时,我不断收到错误消息:

  

PHP致命错误:未捕获错误:在'...'中找不到类'ZipArchive'

结果: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

sudo pecl list的结果:

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

另外,phpinfo产生了这个结果: enter image description here

看起来zip已正确安装。

还有什么我想念的吗?

感谢。

2 个答案:

答案 0 :(得分:3)

检查命名空间,尝试use ZipArchivenew \ZipArchive。否则,提供有关错误消息的更多信息

答案 1 :(得分:0)

PHP 7.2的秘密:

sudo service httpd restart
sudo service php-fpm restart