Problem with imagick in php code

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
bee
Posts: 2
Joined: 2014-04-18T08:11:36-07:00
Authentication code: 6789

Problem with imagick in php code

Post by bee »

Hi,

I have code as below, but display Fatal error: Class 'Imagick' not found in C:\xampp\htdocs\
putenv(getenv('PATH').':/usr/local/bin');
// Read
$img = new imagick($pdf.'[0]');
// Convert to png
$img->setImageFormat('png');
$img->writeImages($png, false);

Can someone help me?

1. I have XAMPP 1.8.3 ,[PHP: 5.5.3], I installed ImageMagick-6.8.9-0-Q16-x64-dll in the path C:\ImageMagick-6.8.9-Q16.
2. download and put php_imagick.dll in xampp/php/ext/
3. add extension=php_imagick.dll in php INI file.
4. stop Apache and MySQL then restart, it display PHP Startup:imagick: Unable to load dynamic library ''C:\xampp\php\ext\php_imagick.dll'.

It can function well in command prompt, but in php appear problem.
Should I install in the path C:xampp\? but somehow I tried in the path but same result with error Fatal error: Class 'Imagick' not found in C:\xampp\htdocs\.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Problem with imagick in php code

Post by Bonzo »

I would guess it is the wrong dll file; it is a bit hit and miss getting the correct one. There is quite a good post about another Imagick install problem but you will need to look back through the threads on how the user sorted their problem - from what I remember it was this year and so you will not have that many threads to search through.
bee
Posts: 2
Joined: 2014-04-18T08:11:36-07:00
Authentication code: 6789

Re: Problem with imagick in php code

Post by bee »

I saw someone success will have imagick in phpinfo.php, Why mine no display imagick in my phpinfo()? Should I install in the path of Xampp?
But I tried before same case happened ?

Anyone can help me?
horst
Posts: 5
Joined: 2014-04-07T01:37:17-07:00
Authentication code: 6789
Location: Aachen, Germany

Re: Problem with imagick in php code

Post by horst »

You first need to check if you are running a x86 (32bit) Apache / PHP or really a x64 bit one. I'm not sure but most installations on Windows maybe x86 (regardless if you running a x64 windows).

I have taken a Imagick extension from here: http://www.peewit.fr/imagick/

I'm running PHP 5.4.26 as apache module and it is a ThreadSafe version what needs to be compiled with MSVC 9

I took the ImageMagick-6.8.9-0-Q16-x86-dll.exe it is for Win32 (x86).

If you work with other versions of Apache and PHP (e.g. x64) you need to choose x64 versions (MSVC 11 compiled) of ImageMagick & Imagick

My Apache and PHP was already running so I installed ImageMagick with the provided Installer. The only important part was to tipp the checkbox that ask you to put the path from ImageMagick into your system-path variable!

After restarting the Apache service I could see Imagick in the list of phpinfo().

Check this and also if you have a number higher than 0 for supported fileformats / imageformats in that phpinfo section. (with my first try installing ImageMagick I got versions that doesn't colaborate together what results in 0 supported fileformats there)
Post Reply