PHP - ZipArchive is enabled but not found

dev.e.loper picture dev.e.loper · Aug 26, 2013 · Viewed 15.1k times · Source

When I look at phpinfo I see that Zip is enabled: enter image description here

extension_loaded('zip') // <- returns true.
function_exists('zip_open') // <- returns true.
class_exists('ZipArchive', false) // <-returns false.

When I try to create a ZipArchive object, I get error: Fatal error: Class 'ZipArchive' not found

PHP Version 5.4.11

Answer

dev.e.loper picture dev.e.loper · Aug 26, 2013

Found the fix by reading this mediatemple kb article. I already had zip.so in /usr/lib64/php/modules/

Thing missing was extension=zip.so entry in php.ini

After adding that entry and restarting Apache, ZipArchive is now recognized.