0

I read on the documentation I should only compile PHP 5.3.3 with "--enable-zip" parameter, but this doesn't work. I did this but class_exists('ZipArchive') always return false. What should I do next?

3 Answers 3

21

Have you tried installing ZipArchive using pecl?

$ pecl install zip

then add extension=zip.so to your php.ini

1
  • 1
    pecl is for most people probably in php-pear.
    – Smile4ever
    Jan 11, 2016 at 12:19
0

Make sure that the Zip class is being loaded by your server by,

  1. Write a quick phpinfo(); script and check if Zip is enabled; and
  2. If it isn't, you can check the /etc/php.d/zip.ini file to make sure that the zip.so file is being loaded when PHP kicks off.
  3. As you can see here make sure you are using the class_exists function correctly for your version of PHP.

[ >= PHP 5.3]

If you are checking if a class exists that is in a specific namespace then you have to pass in the full path to the class:

echo (class_exists("com::richardsumilang::common::MyClass")) ? "Yes" : "No";

Hope that helps.

1
  • Thanks, will look into it. Zip extension is active and ZipArchive class is native so there is no wrong way to check it.
    – Savageman
    Dec 22, 2010 at 12:16
0

pecl install zip: compilation terminated. make: *** [php_zip.lo] Error 1 ERROR: `make' failed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.