从CLI运行时找不到类imagick

$im = new imagick($file);

This line of code will work fine when ran from my browser, but when I try to run it from command line (CLI) then I get the following error...

Class 'imagick' not found

Any ideas why it won't work from CLI?

Found a solution:

sudo aptitude install make php5-dev php-pear
sudo aptitude remove php5-imagick
sudo aptitude install libmagick9-dev
sudo pecl install imagick
sudo /etc/init.d/apache2 restart

http://kvz.io/blog/2008/02/27/class-imagick-not-found/

Run "php -i | grep include_path" and make sure that class file path is in there. If not, you can either add it in your script or your environment (bash profile).

The php cli executable is seperate(as in, a seperate binary file) from what generally gets run through a webserver. So, they can be totally different php versions, with different php.ini files and different extensions compiled in/enabled.