Fatal error: Class 'imagick' not found
P粉296080076
P粉296080076 2023-10-17 11:34:20
0
2
689

I'm trying to install the imagemagic php extension under WampServer 2.

  • I have downloaded and installed ImageMagick. I chose ImageMagick-6.8.8-10-Q16-x86-dll.exe

  • I have downloaded the php extension.

  • I have moved the dll extension I just downloaded to C:wampbinphpphp5.4.16ext

  • I changed php.ini (access it via wamp tray icon > right click > PHP > php.ini) and added "extension=php_imagick.dll" (without quotes) to the extension List.

  • I restarted Apache. I didn't notice the extension showing up in the PHP extensions list in the tray icon, so restarted wampserver. The ImageMagick extension now shows enabled in the list.

However, I can't use it. Doing a quick test returns "Fatal Error: Class 'Imagick' not found". In phpinfo() it only shows that imagemagick has been added to the environment variables.

When I try to test 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 did I do wrong? I'm using win7 32 bit, php 5-4-16 and apache2

P粉296080076
P粉296080076

reply all(2)
P粉716228245

Your library version may be misaligned.

This is how I solved the problem

It's really hard for me to answer all these questions. Looking back, I realize that most of them were correct, it's just that they left out some very finevital details.

1). First and foremost, before you start downloading any library or DLL, you need to look for these three very important parameters, starting with php_info. p>

Run PHP_Info and check:

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). Extract all DLLs from the unzipped bin subfolder and copy them to the Apache bin directory. It's a bunch of CORE_RL_.dll and IM_MOD_RL_.dll and 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 a zip link or just a DLL link. I prefer DLL linking. In my case, I chose the latest version, 3.4.3. Then I went to https://pecl.php.net/package/imagick/ 3.4.3/Windows. Here again we must choose carefully

  1. My PHP version is PHP 5.6
  2. Thread safety is enabled
  3. PHP runs on the architecture x86
  4. So I chose 5.6 Thread Safe (TS) x86

5). Unzip "php_imagick.dll" and copy it to the php ext folder. and all other DLL files to the php folder

6). Use an editor to open php.ini. Search for "extension=" and add this line extension=php_imagick.dll as one of them.

7). Restart Xampp/Wamp or restart Apache and run PHP_INFO again. Imagick should show up. If you still can't see it, please see this link http://php.net /manual/en/imagick.setup.php#119084

Extra Tip: You may need to download the Visual C 14 Runtime. Via this link https://support. microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloadsI chose the latest version.

P粉964682904

The only way I got it to work was using an older version of imagick: php_imagick-3.2.0b1-5.4-nts-vc9-x86.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template