I'm running OSX Leopard with MAMP (a sandbox consisting of Apache/MySQL/PHP). I installed ImageMagick using MacPorts by following this tutorial: http://www.brybot.ca/archives/getting-imagemagick-and-more-to-work-with-mamp-on-os-x/
我正在使用MAMP(一个由Apache / MySQL / PHP组成的沙箱)运行OSX Leopard。我按照本教程使用MacPorts安装了ImageMagick:http://www.brybot.ca/archives/getting-imagemagick-and-more-to-work-with-mamp-on-os-x/
Then I added extension=imagick.so to the php.ini But PHP won't recognize it. It keeps telling me:
然后我将扩展名= imagick.so添加到php.ini但PHP无法识别它。它一直告诉我:
Fatal error: Class 'imagick' not found
Any idea how to fix this?
知道如何解决这个问题吗?
4 个解决方案
#1
Watch out: Imagemagick and Imagick are not the same! While Imagemagick is a CLI suite/lib to manipulate images, Imagick is a PHP Wrapper class to use Imagemagick in PHP natively (read as without using exec() or alike..).
注意:Imagemagick和Imagick不一样!虽然Imagemagick是一个用于操作图像的CLI套件/库,但Imagick是一个PHP Wrapper类,可以在本机中使用Imagemagick(不使用exec()或类似的方式读取它)。
A imho good guide on installing both Imagemagick and Imagick @ OSX is this one.
安装Imagemagick和Imagick @ OSX的imho好指南就是这个。
UPDATED
Give this guide a try: Imagick for MAMP-Pro installation guide (which is my slightly more detailed fork of: Mamp-Imagick-Manual )
试试本指南:想象一下MAMP-Pro安装指南(这是我稍微更详细的分支:Mamp-Imagick-Manual)
#2
(Is case php case-sensitive? If I google around a bit, it's Imagick
with a capital i.) Is it enough to download image-magick? If I read this correctly, you need a php wrapper for image-magick also.
(案例是php区分大小写的吗?如果我稍微google一下,那就是带有资本i的Imagick。)是否足以下载image-magick?如果我读得正确,你还需要一个php-magick的php包装器。
#3
You may need to follow the macports installation instructions for adding /opt/local and /opt/local/bin to your PATH variable.
您可能需要按照macports安装说明将/ opt / local和/ opt / local / bin添加到PATH变量中。
If you've already done that, then find out where MacPorts has put the imagemagic library and copy it to your PHP installation's extension dir (or create a link from your extension dir to the file).
如果您已经这样做了,那么找出MacPorts放置imagemagic库的位置并将其复制到PHP安装的扩展目录(或者从您的扩展目录创建一个链接到该文件)。
By default, MacPorts will compile and install things to work with other MacPorts libraries, so when compiling to work with non-MacPorts libraries, you may need to move files around and tweak paths a bit.
默认情况下,MacPorts将编译和安装与其他MacPorts库一起使用的东西,因此在编译以使用非MacPorts库时,您可能需要移动文件并稍微调整路径。
#4
This question is old but I had the problem today and it seems to be easier than before.
This solution uses OSX 10.13 with MAMP 4 and Homebrew.
这个问题很老,但我今天遇到了问题,而且似乎比以前容易。该解决方案使用OSX 10.13和MAMP 4以及Homebrew。
- Install Image Magick by running
brew install imagemagick
. - Open the file
/Applications/MAMP/bin/php/[yourPhpVersionThere]/conf/php.ini
. - Search the line
;extension=imagick.so
, and delete the ';' at the beginning of the line. - Restart MAMP
通过运行brew install imagemagick安装Image Magick。
打开文件/Applications/MAMP/bin/php/[yourPhpVersionThere]/conf/php.ini。
搜索该行; extension = imagick.so,并删除';'在行的开头。
You are done.
你完成了。
#1
Watch out: Imagemagick and Imagick are not the same! While Imagemagick is a CLI suite/lib to manipulate images, Imagick is a PHP Wrapper class to use Imagemagick in PHP natively (read as without using exec() or alike..).
注意:Imagemagick和Imagick不一样!虽然Imagemagick是一个用于操作图像的CLI套件/库,但Imagick是一个PHP Wrapper类,可以在本机中使用Imagemagick(不使用exec()或类似的方式读取它)。
A imho good guide on installing both Imagemagick and Imagick @ OSX is this one.
安装Imagemagick和Imagick @ OSX的imho好指南就是这个。
UPDATED
Give this guide a try: Imagick for MAMP-Pro installation guide (which is my slightly more detailed fork of: Mamp-Imagick-Manual )
试试本指南:想象一下MAMP-Pro安装指南(这是我稍微更详细的分支:Mamp-Imagick-Manual)
#2
(Is case php case-sensitive? If I google around a bit, it's Imagick
with a capital i.) Is it enough to download image-magick? If I read this correctly, you need a php wrapper for image-magick also.
(案例是php区分大小写的吗?如果我稍微google一下,那就是带有资本i的Imagick。)是否足以下载image-magick?如果我读得正确,你还需要一个php-magick的php包装器。
#3
You may need to follow the macports installation instructions for adding /opt/local and /opt/local/bin to your PATH variable.
您可能需要按照macports安装说明将/ opt / local和/ opt / local / bin添加到PATH变量中。
If you've already done that, then find out where MacPorts has put the imagemagic library and copy it to your PHP installation's extension dir (or create a link from your extension dir to the file).
如果您已经这样做了,那么找出MacPorts放置imagemagic库的位置并将其复制到PHP安装的扩展目录(或者从您的扩展目录创建一个链接到该文件)。
By default, MacPorts will compile and install things to work with other MacPorts libraries, so when compiling to work with non-MacPorts libraries, you may need to move files around and tweak paths a bit.
默认情况下,MacPorts将编译和安装与其他MacPorts库一起使用的东西,因此在编译以使用非MacPorts库时,您可能需要移动文件并稍微调整路径。
#4
This question is old but I had the problem today and it seems to be easier than before.
This solution uses OSX 10.13 with MAMP 4 and Homebrew.
这个问题很老,但我今天遇到了问题,而且似乎比以前容易。该解决方案使用OSX 10.13和MAMP 4以及Homebrew。
- Install Image Magick by running
brew install imagemagick
. - Open the file
/Applications/MAMP/bin/php/[yourPhpVersionThere]/conf/php.ini
. - Search the line
;extension=imagick.so
, and delete the ';' at the beginning of the line. - Restart MAMP
通过运行brew install imagemagick安装Image Magick。
打开文件/Applications/MAMP/bin/php/[yourPhpVersionThere]/conf/php.ini。
搜索该行; extension = imagick.so,并删除';'在行的开头。
You are done.
你完成了。