Inhalt
These was probably the longest journey ever to get something running on the development side . Just a note if some could help to find a faster way . there are several tutorial how to install Imagemagick on MAMP but most outdated or for tech experts . At the end you will find most resources that helped to finalize the puzzle . Getting Imagemagick to run in the Terminal was quite easy with homebrew but to make it accessible from MAMP its a bit a hassle as no where was fully documented. Several PHP versions installed make it not simpler. MAMP 1.9 running with PHP 5.4
MakPorts removed don’t want to install it again just for Imagemagick.
Wrong Phpsize :
The creators of MAMP have not released the usual open source components package with the 2.1.1 release, so you’ll have to do the following. php.h, zend_modules.h and zend_extensions.h can be found in the source code for PHP 5.4.4. Here’s a link to the page with the source code:https://us2.php.net/get/php-5.4.4.tar.gz/from/a/mirror
You’ll want to extract that, and the move the folder to /Applications/MAMP/bin/php/php5.4.4/include, creating the include directory if needed. I believe you’ll need to run ./configure
from within /Applications/MAMP/bin/php/php5.4.4/include/php as well to generate the Zend headers. Then, try the instructions you found again.
1.Copy new PHP 5.4.4 files to the MAMP
2.Set the Path
export PATH=/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.4.4/bin:/usr/local/bin:$PATH:/opt/local/bin
Imagemagick and Ghostscript is installed ?
Terminal :
$ which convert /usr/local/ImageMagick-6.6.7/bin/convert $ which gs
Compiling the ImageMagic Extension for MAMP
Download Imagic remember thats the part needed to make ImageMagic accessible from PHP.
Set the Flags for Mac OS 10.6 Snow Leopard
MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch i386 -arch x86_64 -bind_at_load" export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET cd /imagick/
phpize
./configure --with-imagick=/opt/local make make install
Copy the fresh modul to the related MAMP PHP version
for PHP 5.4.4 /Applications/MAMP/bin/php5.4.4/lib/php/extensions/no-debug-non-zts-20100525/ for PHP 5.3
/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/ for PHP 5.2. /Applications/MAMP/bin/php5.2/lib/php/extensions/no-debug-non-zts-20060613/
Add Extension to MAMP php.ini
extension=imagick.so
Error Debugging
terminal commands
ls -l /usr/local/bin
which phpize ( MAMP have his own phpize version php 3.6 if you add MAMP to your path controll the order . make a copy of your $PATH
echo $PATH
to restore all $PATH take care some needed path will be washed away !
PATH=$(getconf PATH)
To fix the missmatch with the wrong phpize
Discussion on gitHub about wrong phpize version when you installed php via Homebrew
If you run into php error like
PHP Warning: PHP Startup: imagick: Unable to initialize module Module compiled with module API=20090626 PHP compiled with module API=20100525 These options need to match
Your PHP version dont match check it with
php-config --version
and the PHP API Extension version
php -i | egrep “PHP (Extension|Version)”
<em id="__mceDel"><a title="MAMP SERVER Component" href="https://www.mamp.info/en/downloads/index.html"> Donwnload MAMP Server components </a>+ Additional PHP versions for MAMP PRO <em id="__mceDel"><a title="Install Image Magick for PHP on OSX" href="https://verysimple.com/2011/12/21/install-image-magick-for-php-on-osx/" rel="bookmark">Install Image Magick for PHP on OSX</a></em></em>
Install Image Magick for PHP on OSX 2012
Installing ImageMagick PHP into MAMP Pro 2.0.5/2012
Cooking ImageMagic terminal
ImageMagick with MAMP 2010
Getting MAMP 1.9 to work with Image Magick, imagick.so and other flora
Build Compile Universal ImageMagic Extension for MAMP
Resources:<a title="PHP Homebrew version conflicts" href="https://github.com/josegonzalez/homebrew-php/issues/151"> Homebrew PHP Modul Version conflicts </a>