Imagick shows 0 supported formats in phpinfo - php

I have installed the latest release of ImageMagick (ImageMagick 6.8.5-10 2013-06-05 Q16)
Along with the pecl package Imagick version 3.1.0RC2
Installation appeared to be a complete success and I now have an Imagick section showing in phpinfo()
However it shows as having 0 supported file formats. When I check the supported file formats from the command line using ImageMagick directly, they are all there an working. Just not with the php module.
This of course causes problems when trying to use it within PHP. I can instantiate the Imagick object fine:
$im-> new Imagick()
But trying to read a file fails:
$im->readFile('location');
Does anyone have any idea how to fix this?
I am running an Amazon EC2 linux instance with nginx/fcgi/PHP5.4.
Thanks in advance

This is related to a problem with the way how the PHP module of iMagick is installed. I would suggest you revisit your installation and install this properly. Then revisit PHPINFO to confirm that you see all the necessary formats.
Install on Debian
http://rakesh.sankar-b.com/2011/05/25/install-imagemagick-from-source-in-debian/
Install on CentOS
http://rakesh.sankar-b.com/2010/07/13/how-to-install-imagemagick-linux-yum/
http://forum.directadmin.com/showthread.php?t=44449

Related

XAMPP x64 and Imagick in Windows 10 doesn't work

I'm trying to install imagick on XAMPP x64 with PHP x64 architecture, I followed those steps:
1 - Download and install ImageMagick for Windows, I installed this version: ImageMagick-7.0.9-9-Q16-x64-dll.exe
2 - Download Imagick for PHP, I downloaded this version php_imagick-3.4.4-7.2-ts-vc15-x64, added the php_imagick.dll in xampp/php/ext folder and enabled the extension in php.ini.
3 - Download required Imagick binaries, I downloaded this bin ImageMagick-7.0.7-11-vc15-x64 and added them in xampp/apache/bin folder.
4 - Download Ghostscript, I installed this version gs950w64.
Then I restart XAMPP with all related services. In the phpinfo I see the imagick extension and it works but if I run this code I get an ERR_CONNECTION_RESET error.
$im = new Imagick();
$im->pingImage(realpath('sample.pdf'));
echo $im->getNumberImages();
Here the phpinfo:
What's the problem?
Thanks
UPDATE:
If I run "composer show --platform" I get this warning "PHP Warning: Version warning: Imagick was compiled against ImageMagick version 1799 but version 1801 is loaded. Imagick will run but may behave surprisingly in Unknown on line 0". I don't know if it is relevant.
The problem appears only with PDF files, if I run the same code with a jpg image it works correctly
a bit late, but after a hard day of trying to get Windows + PHP + imagick + Ghostview running I want to share my solution.
Using PHP 7.2 (Tread Safe, WIN 32, CGI/FastCGI) I installed the matching PHP-imagick-version without problems (php_imagick-3.4.4-7.2-ts-vc15-x86.zip)
(Tip for CGI/FastCGI: php_imagick.dll as described into the PHP-ext-directory, but the other 150 imagick-dlls to cgi-bin-folder)
Afterwards I installed the actual win32-version (gs952w32.exe) and got lots of "Internal Server Error" and the apache-error-log growed...:-(
Solution:
Moving backwards in older gs-releases (https://github.com/ArtifexSoftware/ghostpdl-downloads/releases) i succeeded to get a running installation with 9.25 (gs925w32.exe).
BTW:
On my private linux-machine the same installation of PHP, Imagick and Ghostview needed only a few minutes...

ImageMagick number of supported formats: has showing value 0

I am using PHPv5.6 I am trying to install imagic library on my window7(32bit) on xampp server.
To install it I followed all the steps showing on this link-
Install Imagick for PHP and Apache on Windows
But I have stuck on its step14. I am not getting any 0 values in ImageMagick number of supported formats. and getting no values in ImageMagick supported formats.
I dont know What I am missing there. Can anyone help me sought out this problem.
This is a common problem when you have downloaded a version of Imagick that was compiled against a different version of ImageMagick than the one you are trying to run it with.
Try downloading both Imagick and ImageMagick from the same place e.g.
http://windows.php.net/downloads/pecl/deps/
http://windows.php.net/downloads/pecl/releases/imagick/

After upgrade, PHP no longer supports PNG operations

After updating to Mac OS X 10.10 (Yosemite) and starting Apache with PHP support, everything works as before except for any image operations on PNG files. I get a Call to undefined function imagecreatefrompng(), while any operation on JPEG files work. So GD is present, but not for PNG.
There is one line in the phpinfo() that looks like the problem: '--with-png-dir=no'
The GD section from phpinfo():
How do I get the included PHP to work with PNG files?
Here's another option, from the guys from liip, here. This is a PHP package that comes pre-built for Yosemite (older versions works too) but it is just one line of code:
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5
After that, everything is ready to work as expected. The configuration that cames with that installation is well suited for Symfony 2 development, but it should work just fine with other use cases.
Finally, if you need to use the updated PHP CLI, too, but you don't want to use the PHP version that comes with the OS, then you could also add to your .bash_profile or similar this line of code:
export PATH=/usr/local/php5/bin:$PATH
I had to fix this by installing PHP 5.5 again via Homebrew. Fairly painless:
https://github.com/Homebrew/homebrew-php
Installation instructions can be found here: https://github.com/Homebrew/homebrew-php#usage
I used the command brew install php55
Don't forget to update your httpd.config - instructions will be shown at the end of the homebrew install.
As #jtotheh said, installing a complete PHP version with PNG and FreeType support compiled in is the way to go.
If you don't want to fiddle through that process, I have prepared complete step-by-step instructions as an answer to a similar question: https://stackoverflow.com/a/26505558/430742

Using PHP Imagick extension on Mac does not find Tiff delegate

I've installed ImageMagick on my Mac and am trying to convert a TIFF image to a JPEG image using the PHP API that is provided by the ImageMagick extension. When I try to do that I get the following error:
no decode delegate for this image format
When I do a convert image1.tiff image1.jpg on the command line it works.
For some reason the PHP extension for Imagick thinks the TIFF delegate is not installed when it clearly is. Why would I get different results and how could I fix this?
I found the solution. I had installed both ImageMagick and the PHP ImageMagick extension php53-imagick using Homebrew. When installing them this way you don't have many options in terms of configuration. php53-imagick was configured to use the Homebrew installation of ImageMagick.
What I did to solve the problem was download and compile the source of the Imagick PHP extension myself. The key configuration that you have to make is ./configure --with-imagick=/user/local or wherever your ImageMagic/wand folder is.
The imagick.so will appear in the modules directory and you'll need to add it to the php.ini
Coming from a different question: There's a more convenient solution in Homebrew with the command
brew install libtiff
brew install imagemagick --with-libtiff
(see Imagemagick can not find deletegates library for .tiff format on mac os x mountain lion for reference)

ImageMagick supported formats no value

I have installed download and install ImageMagick-6.8.3-7-Q16-x86-dll.exe from the link http://imagemagick.org/script/binary-releases.php#windows and I am using Windows 7 and PHP 5.3.8.
When in install this it got installed correctly in my machine and convert commands works perfectly. On my convert config what shows is here:
But on my phpinfo section I get:
ImageMagick supported formats has no value
I got all the image magick values like this https://www.evernote.com/shard/s297/sh/12397c86-d016-4ca4-9415-fd541daeca39/2fc504bf5ddba5693efd3249402b2b5c.
I don't know why it is getting as no value i have installed the same ImageMagick-6.8.3-7-Q16-x86-dll.exe on php 5.3.8 in my 32 bit windows7 machine . The php_imagick.dll i downloded from other website. I don't know what is the issue i am having in install imagemaagick, if it is the issue with php_imagick.dll version can anybody suggest proper php_imagick version for this configuration?
I have spent several days looking for a solution, and I finally found it with Sysinternals procmon.
I found out apache was looking for dll files like IM_MOD_xxxx.dll in folders c:\windows\system and /bin. Copying the files to one of those folders did the trick to me.
Cood luck.
Not all versions of ImageMagick will work with all versions of php_imagick.dll. The Imagick extension v3.4.* in combination with ImageMagick 7.* gave no support for any image format. When I downgraded to ImageMagick 6.9.* the problem was solved.
On an echo of phpinfo you can see which version of ImageMagick is needed. Search for "Imagick using ImageMagick library version" and "Imagick compiled with ImageMagick version" (which should be equal).
List of binary downloads:
https://www.imagemagick.org/download/binaries/
Or older versions:
http://windows.php.net/downloads/pecl/deps/
Step by step instructions for installing ImageMagick on Windows:
https://stackoverflow.com/a/28872879/2366136
Since its first result on google when looking for solution to this issue I'll add one that worked for me. Source: http://forums.zend.com/viewtopic.php?t=2397#p15226
I was having issues with PHP 5.6, it recognized the extension but no formats were supported. (http://windows.php.net/downloads/pecl/releases/imagick/3.1.2/)
Installing latest version of imagemagick(with dynamic libs) and copying DLL files from imagemagickDir/modules/coders/* and imagemagickDir/modules/filters/* to imagemagick root helped, now imagemagick works properly from when calling php.
Don't forget to give IIS access to imagemagick folder.
EDIT:
When IIS successfully recognized formats, I ran into compatibility issues.
Working combo for PHP 5.6:
http://windows.php.net/downloads/pecl/releases/imagick/3.2.0b2/
http://ftp.icm.edu.pl/packages/ImageMagick/binaries/ImageMagick-6.8.8-9-Q16-x86-dll.exe
Check that
MAGICK_HOME=C:\Program Files (x86)\ImageMagick-6.8.8-Q16\modules\coders
is set.
I had the same problem, and tried everything. You do not need - as I thought - ImageMagick installed on your system to run the Imagick module for PHP. You simply need to make sure you include both the CORE_RL_* dlls as well as the IM_MOD_* dlls in the apache/bin directory, and then also the php_imagick.dll in the php/ext directory.
I'm running PHP 7.0.25 x86 via XAMPP on Windows, and these instructions were incredibly simple and helpful:
https://mlocati.github.io/articles/php-windows-imagick.html
There are a lot of answers out there, as the landscape for this program and PHP have changed over time.
I am so cutting edge as to be using PHP 7.1 at the moment. At first I was copying DLLs all over the place like all of the instructions have you do. Luckily, all that is necessary is the latest PECL package and the corresponding version of Imagick for your system, which was the tricky part. You can't used the latest Imagick (version 7 at the time of writing this) if you want to use the PHP extension, until the extension is upgraded. You have to install a version of Imagick on your system that matches the PHP extension version.
As others have instructed, download the latest PECL package for imagick for your PHP version. Since I'm using the thread-safe x64 version of PHP 7.1, I want the 3.4.3RC1 package, the only one with a DLL for my version of PHP at this time.
Of these files, I only need to copy over php_imagick.dll. Next, head over to http://windows.php.net/downloads/pecl/deps/ and download the latest Imagick for your system which is probably going to be the VC14 one at this point, for which it seems just a matter of installing the corresponding C++ Redistributable package on your system for it to work. Simply unzip the files and add the bin to your path. Again, if you have a newer version of Imagick, you'll want to replace it with this one because this is the one that will work with the php extension.
At this point, you should be able to restart apache and confirm that the imagick extension is enabled in the phpinfo. It should show you the version of Imagick for the PHP extension. Again, if the Imagick on your system in your path is a version that matches what is shown for the PHP extension, then you should see the list of supported formats that it is getting from the DLLs from the version 6 Imagick on your system. You will not need to copy them to apache bin or anywhere else, nor make a MAGICK_HOME folder.
Even after installing imagick & imagemagick correctly, if it is not working, please check your Apache Environment PATH Variable. Most probably if the path variable is not showing your ImageMagick inatallation folder, please add that into windows advanced system settings/environment variables/system variables -> PATH.
Restart WAMP server and check to see the phponfo for Apache Environment PATH Variable.
I searched posts and tried various suggestions - for several hours. I did not attain success until I tried the steps here: https://mlocati.github.io/articles/php-windows-imagick.html (as posted by Codesmith - and I agree the steps are short, easy-to-follow). My need was to install on WAMP.
The page behind this link tells how to determine the correct version to download of Imagick and ImageMagick. Just extract three sets of files to stated directories, make a change in php.ini, and restart WAMP. My code uses only JPEG and PNG formats, so of the format-based DLLs, I moved only those.

Categories