Savageman
Savageman

Reputation: 9487

How-to activate the ZipArchive class in PHP 5.3 on CentOS

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?

Upvotes: 0

Views: 47733

Answers (3)

Gregory Hanis
Gregory Hanis

Reputation: 51

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

Upvotes: 0

Andreas Wong
Andreas Wong

Reputation: 60584

Have you tried installing ZipArchive using pecl?

$ pecl install zip

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

Upvotes: 21

Jason
Jason

Reputation: 393

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.

Upvotes: 0

Related Questions