PHP: ImageMagic not loading from Apache (MAMP) but from CLI - php

I manage to install ImageMagick on OSX Mavericks + MAMP 2.0 which has php 5.3.6.
But Imagick isnt loading through apache. It works on CLI. As an example I have 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 on browser it says,
Imagick is not loaded
if I run this on 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 both loads the same php.ini, but if I do a phpinfo on browser it does NOT show Imagick extension as loaded, but if I do
$ /Applications/MAMP/bin/php/php5.3.6/bin/php -i | less
I can 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,
Any ideas whats really happening here?

Related

I have installed Imagick but am seeing "Error: Class 'Imagick' not found". What am I missing?

I am on RHEL 7.
I have installed imagick with...
yum install php-imagick
I added to my php.ini...
extension=imagick
I have confirmed that I am using the correct php.ini in my file system. It is the "Loaded Configuration File" when I print phpinfo() to a file.
I restarted apache.
In my PHP application, I am getting...
Error: Class 'Imagick' not found
At least at the command line, Imagick is installed...
[root#localhost rh-php72]# convert --version
Version: ImageMagick 6.7.8-9 2019-04-15 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
But the class is not found in my PHP app.

Windows PHP Imagick not working

I am trying for 1 days and this php imagick don't work in windows. It shows
ImageMagick number of supported formats: 0
ImageMagick supported formats no value
First I went to official php website from here
http://windows.php.net/download/
And downloaded VC14 x64 Non Thread Safe (2017-May-09 23:02:49) PHP 7.1.5
I extracted it into C:\ProgramData\php and added it to PATH variable.
And from that directory i renamed php.ini -devlopment to php.ini
And changed line 738 to extension_dir = "ext" so that extensions can be loaded in PHP.
Then php must be working now.
I went to http://windows.php.net/downloads/pecl/releases/imagick/3.4.3/
And downloaded php_imagick-3.4.3-7.1-nts-vc14-x64.zip
And from that zip file i extracted php_imagick.dll into C:\ProgramData\php\ext directory
And also from that zip file I extracted CORE_RL_*.dll into C:\ProgramData\php folder.
And I added extension=php_imagick.dll to php.ini file at line 892
After that i went to http://windows.php.net/downloads/pecl/deps
And downloaded ImageMagick-6.9.3-7-vc14-x64.zip and extracted content of that folder to C:\ProgramData\ImageMagick directory. And I added C:\ProgramData\ImageMagick\bin to my path.
I think I have done all configuration.
But when I create index.php and add phpinfo() function to file in desktop and try to run
php -S localhost:8080
and go to localhost:8080 in web browser it shows
imagick module enabled
imagick module version 3.4.3
imagick classes Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version ImageMagick 6.9.3-7 Q16 x64 2016-03-27 http://www.imagemagick.org
Imagick using ImageMagick library version ImageMagick 6.9.3-7 Q16 x64 2016-03-27 http://www.imagemagick.org
ImageMagick copyright Copyright (C) 1999-2015 ImageMagick Studio LLC
ImageMagick release date 2016-03-27
ImageMagick number of supported formats: 0
ImageMagick supported formats no value
Clearly it is not working .Where did I make mistake. Imagik is so painful to install :(
Recently I found this solution:
I went to C:\ProgramData\php and deleted CORE_*.dll file which i copied .
I needed to copy that as doing php -v was showing error at that time.
and after immediately deleting and rebooting server it showed
ImageMagick number of supported formats: 234
I don't know what is happening but i am happy it is working
And above steps will work as documentation for other user who are in problem like me :)

Unable to work on ImageMagick properly on Windows xampp

I read all the questions before posting this .
I am trying to install ImageMagick on my local system Windows 7.It gets installed without But when i try using it to crop images I get NoDecodeDelegateForThisImageFormat .
I am running Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7
This is what i did
I installed ImageMagick ImageMagick-6.8.9-8-Q16-x86-dll.exe (I tried 6.8.1 and 6.7 also)
I got the dll from http://pecl.php.net/package/imagick/3.1.2/windows TS for PHP 5.4
Updated php.ini
The server started with out problem .
I checked via cmd the ImageMagick is working fine.
phpinfo() ImageMagick number of supported formats: 0
I tried many DLL's but none is working i need a solution to this .
Also phpinfo keeps on showing ImageMagick version:ImageMagick 6.8.8-4 Q16 x86 2014-01-29 even when i uninstalled it / updated it .
identify -version
Version: ImageMagick 6.8.9-8 Q16 x86 2014-08-26 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo freetype jbig jng jp2 jpeg lcms lqr pangocairo png ps rsv
g tiff webp xml zlib
I am trying to open Jpg.
ImageMagick inside php is a really different from the standalone cmd version.
So, you need not only the php_imagic.dll connected to your php.ini.
But also the CORE_RL_*_.dll files in the Apache bin directory.
This will enable the readers.
Now you need the ENcoders. These are obtained from the standalone installation and located in [ImageMagick install dir]\modules\coders. Copy them to Apache's bin directory as well.
Now check the phpinfo();
The downside of this is that you need to match dll's from Standalone version to the one that is Compiled in the php-extension.

installed imagick not seen by php_info

I am not very experienced on linux, and need help here.
I have installed ImageMagick, and you can see the version below:
[root#zpanel temp]# convert -version
Version: ImageMagick 6.8.5-4 2013-05-02 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib fontconfig freetype jng jp2 jpeg lcms png ps tiff x xml zlib
But I cannot see it in my php_info(check url : http://www.galepress.com/phpinfo.php). I have restarted httpd etc, but no good.
ps : I have also run the following command and get the warnings:
[root#zpanel temp]# php -m | grep imagick
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/src/imagick-3.0.1/modules/imagick.so' - libMagickWand.so.2: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/imagick.so' - /usr/lib64/php/modules/imagick.so: cannot open shared object file: No such file or directory in Unknown on line 0
How to install php5-imagick package on Debian:
apt-get install php5-imagick
In case of dependencies problem you may need to try installing the older version:
apt-get install php5-imagick/oldstable
If everything goes well, don't forget to restart the Apache service:
/etc/init.d/apache2 restart
You need to install ImageMagick for php environment.
So, for now you have installed ImageMagick only in Linux

ImageMagick not working. "Call to undefined function NewMagickWand()"

I installed ImageMagick following the instructions on this site.
When I check my phpinfo() there is a whole section on imagick now.
imagick module enabled
imagick module version 3.0.1
imagick classes Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
ImageMagick version ImageMagick 6.5.7-8 2010-12-02 Q16 http://www.imagemagick.org
ImageMagick copyright Copyright (C) 1999-2009 ImageMagick Studio LLC
ImageMagick release date 2010-12-02
ImageMagick number of supported formats: 202
However when I try to use it I get this error:
Fatal error: Call to undefined function NewMagickWand()
I have never used image magick before.
Did I not install it right? Is there more extensions I need to install?
You need the MagickWand module/extension installed for it to work. See: http://www.magickwand.org/

Categories