I am using AWS EC2 and installed the Imagemagick and php imagick extension using the below steps:
Steps
cd ImageMagick-6.7.8-9 - go where you placed the folder
./configure
make
make install
make check
install imagick extension from pecl.php.net/package/imagick/download 3.1.2
cd imagick-3.1.2
phpize
./configure --with-imagick=/opt/local
make
make install
Copy imagick.so in your PHP extensions folder and add extension=imagick.so in php.ini
When I run php -m | grep imagick, I get the below warning:
PHP Warning: Module 'imagick' already loaded in Unknown on line 0
PHP Warning: Module 'imagick' already loaded in Unknown on line 0
imagick
When I run convert -version, it shows the below message
Version: ImageMagick 6.7.8-9 2016-06-22 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
When I run php -m, it shows Imagick in the list. But print run phpinfo() does not show Imagick.
Also when I am trying to create the instance of Imagick it is giving Fatal Error that Class not found.
Related
I've followed these steps to install imagemagick and php extension imagick in my computer with Mac OS Catalina and I can't seem to find a way.
I always get the following error when trying to install imagick with $ sudo pecl install imagick:
php_imagick.h:42:10: fatal error: 'php.h' file not found
#include "php.h"
^~~~~~~
1 error generated.
make: *** [imagick_file.lo] Error 1
ERROR: `make' failed
I'm using php.7.3.11.
Apparently Mac OS X Catalina decided to move the headers to another folder and now it doesn't seem to find them.
I've been reading this answer but seems like the solution is too long to be true. Isn't there any other more simple and straight forward method?
It seems others manage to fix it for other extensions with much less trouble.
However, I'm not quite sure the steps for Imagick are exactly the same...
I had this same issue with my new MacBook Air and Catalina. It was a because I did not have PHP installed with brew. I looked at the page you linked to, and I am assuming you have already completed the brew install pkg-config imagemagick. This is what I would do to get clean it up and get it working, see below.
Remove your existing imagemagick and pkg-config that were just installed (and PHP if it shows up in the versions list)
First, we get the php #ver name if necessary. If you don't see PHP in the list then we don't need to remove it, just remove the other two.
brew list --versions
...
imagemagick 7.0.10-0
...
pcre 8.44
php#7.3 7.3.16
pkg-config 0.29.2_2
...
Stop the php service if it is running, in my case it is #7.3
brew services stop php#7.3
Next we remove the items having issue
brew remove php#7.3 pkg-config imagemagick
or simply
brew remove pkg-config imagemagick if PHP not installed with brew
Restart your computer (optional, but I like to do it)
Now we install the items again, include PHP this time if it was not installed with brew last time
brew install php#7.3 pkg-config imagemagick
Add PHP to your path for cmd line if not already there (optional)
echo 'export PATH="/usr/local/opt/php#7.3/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php#7.3/sbin:$PATH"' >> ~/.bash_profile
To have launchd start php#7.3 now and restart at login:
brew services start php#7.3
Or, if you don't want/need a background service you can just run:
php-fpm
Confirm PHP and imagemagick and perl/pecl are the expected versions
php -v
PHP 7.3.16 (cli) (built: Mar 19 2020 11:19:09) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.16, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.16, Copyright (c) 1999-2018, by Zend Technologies
convert --version
Version: ImageMagick 7.0.10-0 Q16 x86_64 2020-04-04 https://imagemagick.org
Copyright: © 1999-2020 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(3.1)
Delegates (built-in): bzlib freetype gslib heic jng jp2 jpeg lcms ltdl lzma openexr png ps tiff webp xml zlib
pecl version
PEAR Version: 1.10.10
PHP Version: 7.3.16
Zend Engine Version: 3.3.16
Running on: Darwin mbookair.local 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64
Now install iMagick using pecl
pecl install imagick
hit ENTER when you see the path question for 'autodetect'
When it's complete you can confirm the module is loaded
php -m | grep imagick
if it's loaded it will return one line with the word imagick
Test from command line imagick installed correctly
cd to your user home dir
cd ~
Run PHP as interactive shell from cmd line
php -a
Code to test at cmd line:
$im = new Imagick ();
$im->newImage (300, 225, "blue");
$im->writeImage ("test_imagick.jpg");
Exit php interactive mode by typing exit, then check if the bright blue test_imagick.jpg was created in your user dir
Troubleshooting Notes
If you are getting a warning about:
"PHP Warning: Module 'imagick' already loaded in Unknown on line 0
Warning: Module 'imagick' already loaded in Unknown on line 0"
This may be left over from the previous pecl install that did not complete. Check your php.ini file and remove duplicate extension="imagick.so" entry
There is a bug in home brew, here is the link
https://github.com/Homebrew/homebrew-core/issues/41081
When you get tired of home brew, switch to Ubuntu, install imagick no fuss package installation.
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.
I am having problems getting October CMS to update:
Update failed
"Class 'ZipArchive' not found" on line 51 of /var/www/html/jdd/htdocs/vendor/october/rain/src/Filesystem/Zip.php
And if I do php -m, i get the following warning:
PHP Warning: PHP Startup: Unable to load dynamic library 'zip.so' (tried: /usr/lib64/php/modules/zip.so (/usr/lib64/php/modules/zip.so: undefined symbol: zip_libzip_version), /usr/lib64/php/modules/zip.so.so (/usr/lib64/php/modules/zip.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Strange thing is, in my /etc/php.d/ folder, the zip.ini file contains the line: extension=zip.so. whereas all other .ini files in /php.d do not include the ".so" extension (eg: for the json.ini file, the line reads: extension=json). I have tried removing the ".so" from the zip.ini extension= line, but it still won't work.
As far as I know, the system is only running x86_64 executables (how do I check this with absolute certainty - all binaries are showing as .x86_64 or .noarch?).
I have tried other versions of php:
-php 5.4 installs zip.so fine (it loads correctly), except October requires at least php 7.0.
-php 7.0 to 7.3 all install zip.so, but the extension still does not load.
Can anyone help?
I've got the same problem and found following solution:
Search for installed php modules:
yum list installed | grep php*
Try to locate installed php-zip module:
rpm -ql php72-php-pecl-zip
You will see something like this:
/etc/opt/remi/php72/php.d/40-zip.ini
/opt/remi/php72/root/usr/lib64/php/modules/zip.so # <----
/opt/remi/php72/root/usr/share/doc/pecl/zip
Then just create symlink to this file in directory where php searches modules by default:
ln -s /opt/remi/php72/root/usr/lib64/php/modules/zip.so /usr/lib64/php/modules/zip.so
After this steps I finally saw zip extension in php -m output and now can use class ZipArchive.
Also you should probably restart your httpd service.
1 - Download manually the last ZIP pecl lib at https://pecl.php.net/package/zip
2 - Install it with pecl in the downloaded file
sudo pecl install zip-1.19.1.tgz
3 Enable zip on php.ini
extension=zip
Please check you are using latest libzip5 version 1.5.1 from remi-safe repository (which is mandatory, and enabled by default)
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
How goes it folks, I've been trying to install imagick on a Centos server with absolutely no luck.
ImageMagick is running fine. MagickWand is installed and the module compiles with no problem.
# which MagickWand
/usr/local/bin/MagickWand
# MagickWand --version
6.7.6 Q16
# which convert
/usr/local/bin/convert
# convert -v
Version: ImageMagick 6.7.6-8 2012-05-03 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
[imagick]# make install
Installing shared extensions: /usr/lib/php/modules/
Installing header files: /usr/include/php/
# php -m | grep imagick
PHP Warning: PHP Startup: Unable to load dynamic library'/usr/lib/php/modules/imagick.so' - /usr/lib/php/modules/imagick.so: undefined symbol: MagickGetImageBluePrimary in Unknown on line 0
Is anybody familiar with this error?...Any help is appreciated.
I had exactly the same error. the problem occurs for the imagick imagick module version-3.0.1. Installing imagick-2.3.0 version works correctly