php 找不到类,PHP错误:找不到类“ Imagick”
PHP错误:找不到类“ Imagick”
我收到错误“找不到类'Imagick'”。 我需要以某种方式使该库可用于php。 我在Fedora 8上使用的是PHP 5.2.6。我的php_info没有提及ImageMagick。
我已经尝试过:百胜安装ImageMagick并重新启动apache,这是行不通的。
我还向我的php.ini文件中添加了extension = imagick.ext并重启了apache,但是这没有用。
Andrew Thomas asked 2020-01-06T10:48:45Z
8个解决方案
53 votes
对于所有对此有疑问的人,我做了本教程:
如何在ubuntu上安装Imagemagick和Php模块Imagick?
我做了这7个简单的步骤:
更新库和包
apt-get update
删除过时的东西
apt-get autoremove
对于ImageMagick的库
apt-get install libmagickwand-dev
对于Imagick的核心课程
apt-get install imagemagick
用于创建二进制文件,以及之间的连接
pecl install imagick
将扩展名追加到php.ini
echo "extension=imagick.so" >> /etc/php5/apache2/php.ini
重新启动Apache
service apache2 restart
我发现了一个问题。 PHP在名为/ usr / lib / php5 / 20100525的文件夹中搜索.so文件,而imagick.so存储在名为/ usr / lib / php5 / 20090626的文件夹中。 因此,您必须将文件复制到该文件夹。
Rodrigo Carmona answered 2020-01-06T10:49:48Z
18 votes
来自:[http://news.ycombinator.com/item?id=1726074]
对于基于RHEL的i386发行版:
yum install ImageMagick.i386
yum install ImageMagick-devel.i386
pecl install imagick
echo "extension=imagick.so" > /etc/php.d/imagick.ini
service httpd restart
使用yum软件包管理器,这在其他i386发行版上也可能起作用。 对于x86_64,只需将.i386替换为.x86_64
Andrew Thomas answered 2020-01-06T10:50:17Z
11 votes
的Ubuntu
sudo apt-get install php5-dev pecl imagemagick libmagickwand-dev
sudo pecl install imagick
sudo apt-get install php5-imagick
sudo service apache2 restart
有些依赖关系可能已经满足,但不包括Apache服务,这是PHP使用2690564347583267267840类所需的一切。
Alastair answered 2020-01-06T10:50:41Z
10 votes
对于在Mac OSX上运行的MAMP
找出什么版本的PHP并通过brew安装正确的版本
brew install homebrew/php/php56-imagick
通过修改MAMP中的php.ini模板来添加扩展名

验证Imagick

Gajen Sunthara answered 2020-01-06T10:51:14Z
5 votes
Debian 9
我只是做了以下事情,其他所有需要的东西也都自动安装了。
sudo apt-get -y -f install php-imagick
sudo /etc/init.d/apache2 restart
Juergen answered 2020-01-06T10:51:38Z
3 votes
在PHP 7中安装Imagick:
sudo apt-get install php-imagick
Sadee answered 2020-01-06T10:51:58Z
1 votes
用于php:XXX基于Debian的映像的Docker容器安装:
RUN apt-get update && apt-get install -y --no-install-recommends libmagickwand-dev
RUN pecl install imagick && docker-php-ext-enable imagick
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* || true
emix answered 2020-01-06T10:52:18Z
0 votes
在AWS的EC2上,我这样做:
yum list | grep imagick
然后找到了我可以安装的列表...
php -v
告诉我我拥有哪个版本的php,以及哪个版本的imagick
yum install php56-pecl-imagick.x86_64
做到了。 请享用!
Scott answered 2020-01-06T10:52:52Z
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)