Reputation: 1068
I am trying to install imagemagic php extension under WampServer 2.
I've downloaded and installed ImageMagick . I've chosen ImageMagick-6.8.8-10-Q16-x86-dll.exe
I've downloaded the php extension.
I've moved the dll extension I just downloaded to C:\wamp\bin\php\php5.4.16\ext\
I've altered php.ini (accessed it through wamp tray icon > right-click > PHP > php.ini) and added "extension=php_imagick.dll", without the quotes, to the extensions lists.
I restarted Apache. Not noticing the extension displayed on the PHP extensions list from the tray icon, I restarted the wampserver. ImageMagick extensions now shows enabled on the list.
However, I cannot use it. Doing a quick test returns "Fatal error: Class 'Imagick' not found". In the phpinfo() shows only that the imagemagick has been added to env variables.
when I try to test the imagick :
$im = new imagick( 'test.jpg' );
// resize by 200 width and keep the ratio
$im->thumbnailImage( 200, 0);
// write to disk
$im->writeImage( 'test_thumbnail.jpg' );
I get the error:Fatal error: Class 'imagick' not found
What am I doing wrong?
I'm working with win7 32 bit, phph 5-4-16 and apache2
Upvotes: 37
Views: 130131
Reputation: 2318
On mac M2 I installed it via brew on top of my php install.
As described here: https://matthewsetter.com/install-php-imagick-extension-macos/
brew install imagemagick
brew install pkg-config
sudo pecl install imagick
Upvotes: 0
Reputation: 760
You might be having mis-aligned library versions.
Here's how I solved it
I had really struggled with all these answers. Looking back I realised most of them are correct except they leave out some very fine details that are crucial.
1). First and foremost, before you start downloading any libraries or DLLs you want to start with your php_info to find out these three very important parameters.
Run it on your server: <?php phpinfo() ?>
and check: for
- Architecture : x86 or x64. Your computer might be x64 but your php is running on x86 so don't assume
- Thread Safety : yes or no. Also very important.
- Your PHP Version
2). Download ImageMagick from: https://windows.php.net/downloads/pecl/deps/. My computer is x64 but my php is running x86 so I downloaded ImageMagick-7.0.--vc*-x86.zip
3). Unzip and copy all DLLs from the unzipped bin subfolder to the Apache bin directory. It's a bunch of CORE_RL_.dll and IM_MOD_RL_.dll plus a few other DLLs. In my case, [zippeddownload]/bin/* ->copied to -> C:\Xampp\apache\bin
4). Go to http://pecl.php.net/package/imagick. You can select the zip link or just the DLL link. I prefer the DLL link. In my case I selected latest version 3.4.3. Which then took me to https://pecl.php.net/package/imagick/3.4.3/windows. Here we have to make another careful choice
5). Unzip and copy "php_imagick.dll" to the php ext folder. And all other DLL files to the php folder
6). Using an editor open php.ini. Search for "extension=" and add this line extension=php_imagick.dll as one of them.
7). Restart Xampp/Wamp or just restart Apache and run PHP_INFO again. Imagick should display. If you still can't see it refer to this link http://php.net/manual/en/imagick.setup.php#119084
Bonus tip: You might need to download visual c++ 14 runtime. From this link https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads I chose the latest version.
Upvotes: 27
Reputation: 107
I was able to get WAMPSERVER 3.2.3 to work. It turns out that there are several php.ini files. I had to change the one in the directory for the Apache server to get ImageMagicK to work with LocalHost.
I added the extension to the php.ini file in the apachexx.xx.xx\bin directory
extension=imagick
I had paths which still pointed to the PHP directories and that worked for me.
Upvotes: 0
Reputation: 1068
The only way that I make it works is by using an older version of imagick:php_imagick-3.2.0b1-5.4-nts-vc9-x86
.
Upvotes: 1
Reputation: 863
Did you try using the proper casing for the class, starting with capital "i"?
$im = new Imagick( 'test.jpg' );
In php, class and files names and not case-sensitive, but classloaders are.
Upvotes: 0
Reputation: 2989
php -m | grep imagick
.sudo apt-get remove --purge php5-imagick && sudo apt-get install php5-imagick
Regards
Upvotes: 23
Reputation: 261
do a <?php phpinfo(); ?>
in any page. This will show all the services running on the service. If it is running then it will show you in which directory.
If you are using WHM panel you might have to install imageMagick there
Upvotes: 0