PHP: ImageMagic does not boot from Apache (MAMP), but from the CLI

I managed to install ImageMagick on OSX Mavericks + MAMP 2.0, which has php 5.3.6. But Imagick does not load via apache. It works on CLI. As an example, I have the following code,

<?php

if (!extension_loaded('imagick')) {
  echo "Imagick is not loaded";

}else{ 
  echo "Imagick is loaded";
  var_dump(Imagick::getVersion());
}

?>

if I run this in a browser, it says

Imagick is not loaded

if I ran this on the CLI,

$ /Applications/MAMP/bin/php/php5.3.6/bin/php /Development/test.php

Imagick is loaded
array(2) {
  ["versionNumber"]=>
  int(1672)
  ["versionString"]=>
  string(68) "ImageMagick 6.8.8-3 Q16 x86_64 2014-02-19 http://www.imagemagick.org"
}

CLI and Apache load the same php.ini, but if I do phpinfo in the browser, it DOES NOT show the Imagick extension as downloaded, but if I do

$ /Applications/MAMP/bin/php/php5.3.6/bin/php -i | less

I see,

imagick

imagick module => enabled
imagick module version => 3.1.2
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
ImageMagick version => ImageMagick 6.8.8-3 Q16 x86_64 2014-02-19 http://www.imagemagick.org
ImageMagick copyright => Copyright (C) 1999-2014 ImageMagick Studio LLC
ImageMagick release date => 2014-02-19
ImageMagick number of supported formats:  => 214
ImageMagick supported formats => 3FR,

What ideas really happen here?

+3
source share

All Articles