PHP Fatal error: Uncaught Error: Class ‘ZipArchive’ not found in

PHPzipziparchive

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:
enter image description here

It looks like zip is installed correctly.

Is there anything else I'm missing?

Thanks.

Best Answer

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

Related Topic