Class imagick not found when ran from CLI

好久不见. 提交于 2020-01-15 11:54:49

问题


$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?


回答1:


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/




回答2:


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.




回答3:


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).



来源:https://stackoverflow.com/questions/10624582/class-imagick-not-found-when-ran-from-cli

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!