tags:

views:

609

answers:

3

Okay, Here's a breakdown of what's up:

  1. <? $foo = new Imagick(); ?> works without error when ran from the command-line (e.g., sudo php myscript.php
  2. However, when run via the web browswer I get Fatal error: Class 'Imagick' not found in /var/www/lhackwith_www/test_html/magic.php on line 1.
  3. magickwand is not installed
  4. extension=imagick.so is in imagick.ini which is successfully being read according to phpInfo();
  5. However, imagick is NOT showing up in PHP info.

Any advice would be appreciated.

A: 
VolkerK
Good advice. However, I checked the log levels and everything else and it just parroted back to me the same "not found" error.
Levi Hackwith
Is php installed as cgi or as module?
VolkerK
PHP is a module of Apache
Levi Hackwith
The apache server is (most probably) using another user account, maybe with a different environment (path, libpath, ...). Let's see if ldd can resolve all dependencies when running on the webserver's "user" account.
VolkerK
ldd /usr/lib/php/modules/imagick.so linux-gate.so.1 => (0x00b6b000) libWand.so.10 => /usr/lib/libWand.so.10 (0x00497000) libMagick.so.10 => /usr/lib/libMagick.so.10 (0x001d8000) libc.so.6 => /lib/libc.so.6 (0x00658000) ....That's a sample of the output I got from ldd. It appears that I'm not missing any dependencies (everything was installed via YUM on CentOS (imagick 2.2.1)
Levi Hackwith
/usr/lib/php/modules/imagick.so not readableldd: /usr/lib/php/modules/imagick.so: No such file or directoryThat's what I get when I run your script
Levi Hackwith
I also want to note that all other modules in that folder are readable minus imagick.so and that the permissions on imagick.so are wide open (777)
Levi Hackwith
The first output you got from the command line version and the "not readable/no such file" output is from the webserver test?
VolkerK
A: 

What operating system are you using? I've had several problems on Mac OSX that basically makes installing some extensions OVERLY painful. However, the Imagick install should be really simple, for most operating systems.

On your command line, type php -i | grep ini, and make sure the php.ini that is listed as being loaded is the same as the php.ini that phpinfo() says is being loaded. If these are different, that's where you have to start. Make sure extension=imagick.so is in both ini files, also - verify that they are loading extensions from the same directory (99% chance they will be, but who knows - you could be an exception).

After you've verified that (possibly) both php.ini files are loading imagick.so and it's still not working, try to tail -f /path/to/apache/error_log (assuming you're using apache, of course..) and restart apache. You're looking here for php warnings about loading libraries and/or extensions. Hopefully it will point you in the right direction.

Hope this helps,

Jim

JimR
Thanks for your help, CentOS is the OS I'm using. The web server is apache.
Levi Hackwith
Is anything on your system 64bit?
JimR
No, I believe we're running 32-bit
Levi Hackwith
A: 

What I ended up doing:

Storing the orientation of the image in the DB and then using alternatiff to dynamically rotate the image to the orientation that was stored. No image manipulation needed.

Thanks for your help though.

Levi Hackwith