I need to install imagick extension for php. I have already installed Image Magick. Then I did "sudo pecl install imagick". After this I had such output in console:
Installing '/usr/include/php/ext/imagick/php_imagick.h'
Installing
'/usr/include/php/ext/imagick/php_imagick_defs.h'
Installing
'/usr/include/php/ext/imagick/php_imagick_shared.h'
Installing
'/usr/lib/php/extensions/no-debug-non-zts-20090626/imagick.so'
but as I'm using XAMPP, my extension dir( as I understand ) is /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626. So what should I do to make this working, I tried to put .so file in extensions dir and to add extension=imagick.so record in php.ini and to restart apache, unfortunately this didn't work. Forgot to mention, I'm using osX and XAMPP
I followed #Nodashi link:
http://www.imagemagick.org/script/download.php#macosx
Here are steps you can to follow since I'm same Mac developer.
To install imagemagick:
brew install imagemagick
Successfully:
🍺 /usr/local/Cellar/imagemagick/7.0.10-0: 1,487 files, 24.3MB
To install ghostscript:
brew install ghostscript
Successfully:
🍺 /usr/local/Cellar/ghostscript/9.51_1: 671 files, 87.4MB
Find the magick:
which magick
Then:
/usr/local/bin/magick
Try to run it to test a image then you will find it works:
magick origin.jpg converted.png
So let's do it by PHP way
Create a new php file:
sudo touch magick.php
Enter the code which we will use the 'exec' function to run the magick program:
<?php
shell_exec('magick origin.jpg converted_php.png');
?>
After that we run it by:
sudo /Applications/XAMPP/xamppfiles/bin/php magick.php
Great, we can see there is a image file converted_php.png !!
Did you install ImageMagick that is required to use imagick : ImageMagick for MacOSx
Related
sorry if there is a duplicate question for this but I'm trying to set this up for hours now and it just doesn't work.
I have a Debian 11 server with "KeyHelp" installed on it (little brother of plesk). It comes with PHP 7.4 but provides a simple Dashboard where you can install other PHP versions. I installed PHP 8.1 and tried to install the mongodb extension via PECL.
After "pecl install mongodb" I added "extension=mongodb.so" and after that didn't show up the extension on the phpinfo page, I double checked if the extension is really in the extension folder of php, where it was.
Turns out that I installed the extension for PHP 7.4 and not for PHP 8.1. Finally I tried to force PECL to install it for PHP 8.1 but it says "phpize8.1 command not found". I found no way to install phpize8.1, can somebody help me out with that?
Thanks in advance!
I am using Ubuntu 20.04
I have PHP 8.1 version. You have to install modules of PHP
sudo apt install php8.1-mongodb
List the modules
php -m
It's not exactly Debian. I hope it helps you.
If you run command:
sudo apt install php-dev
System will install automatically the correct version of php{x}-dev for your distribution, and all it's dependencies, included PECL.
another way is try to run:
/usr/bin/phpize
If this command works, you need to add phpize to your PATH:
PATH=$PATH\:/usr/bin; export PATH
In this way phpize will work in future.
Can anyone help me install php-redis in MAC OSX .
brew install php-redis
not working.
pecl install php-redis
also not working getting -
invalid package name/package file "php-redis".
Homebrew Error:
homebrew_error
git clone https://www.github.com/phpredis/phpredis.git
cd phpredis
phpize && ./configure && make && sudo make install
Add extension=redis.so in your php.ini
brew services restart php#7.2
make test
You can check working or not
php -r "if (new Redis() == true){ echo \"\r\n OK \r\n\"; }"
As of 2019, with homebrew php7.2 and up, pecl is now installed by default alongside the php binaries.
To see this for yourself type which pecl.
Steps to install
Check your version of redis, then find a suitable version of the extension here.
If unfamiliar with pecl, type pecl to see the options.
Issue pecl install redis-5.0.2. (or your version). Enter no to each question asked if you're not sure.
If that succeeds check the new file it created at: /usr/local/lib/php/pecl/20180731/redis.so
The install will have added extension="redis.so" to top of your php ini.
Check that by opening the file /usr/local/etc/php/7.3/php.ini.
(assuming you're on 7.3 there)
brew services restart php.
php -i | grep Redis
Redis Support => enabled
Redis Version => 5.0.2
This is what I just did in September 2019 and it works for me.
If what mwal wrote above doesn't work (please try his/her answer first),
first, try to uninstall first (if you have it but broken):
sudo pecl uninstall redis
and after that run:
sudo pecl install redis
After that, ini the php.ini, use full path for the extension.
Mine was /usr/local/Cellar/php#7.3/7.3.21/pecl/20180731/redis.so (assuming you are using php#7.3)
so at the top of my php.ini file is like this:
extension="/usr/local/Cellar/php#7.3/7.3.21/pecl/20180731/redis.so"
Here are steps to use pickle, for PHP >= 7.3 (tested with 8.1):
brew install pickle
pickle install redis
Find your php.ini location via php -i|grep php.ini
Edit the php.ini, insert extension=redis. Preferable at Dynamic Extensions section.
No restart of Apache httpd service is required. You may test your PHP code with Redis
Bonus
If you use VS Code, to enable intellisense / auto complete, at Preference -> paste intelephense.stubs at Search setting box -> Add Item -> select redis.
If you got the following error,
Please make sure the PHP Redis extension is installed and enabled
despite doing everything in the verified answer above, try valet restart . It worked for me
I have tried all these solutions but didn't work for me for a while so I tried this link https://developer.redis.com/develop/php/ from the original docs and it works as charm
If someone gets an error during sudo pecl install redis
Warning: mkdir(): File exists in System.php on line 294
PHP Warning: mkdir(): File exists in /opt/homebrew/Cellar/-----/pear/System.php on line 294
that means you need to create the broken directory manually.
Try to create the directory...
pecl config-get ext_dir | pbcopy
mkdir -p {paste clipboard value}
# in my case, it was
mkdir -p /opt/homebrew/lib/php/pecl/20200930
Now try to install any pecl extensions.
sudo pecl install redis
After installing any extension, restart php
brew services restart php
Happy coding :)
Currently, I have cloned a project. I have PHP 7 on Ubuntu 14.04 64-bit.
The ImageMagick library is installed using the following command
sudo apt-get install php-imagick
But when I try image manipulation through this library, it throws the following exception
(1/1) NotSupportedException
ImageMagick module not available with this PHP installation.
How can I install this software with the latest PHP version?
Note: I am using Laravel 5.4 in this project.
You have to add extension=imagick.so in your php.ini file.
Location:
You can do some thing like this for the fastest way:
php -i | grep 'php.ini'
The result is like that:
Loaded Configuration File => /usr/local/lib/php.ini
Or call <?php phpinfo(); ?> from some php file to get this information :)
PS: Source
I had the same problem on my computer, and what solved it was:
Instead of installing sudo apt install php-imagick, I installed sudo apt install php7.4-imagick (or whatever version your PHP installation is).
This, in combination with Maraboc's answer did the trick for me.
I am trying to install Image Magick on Fedora machine. I have successfully installed imagick before using yum without any problems encountered. But on this particular server, yum did not successfully install image magick because 'PHP and Apache were not installed with Yum' in the first place. This was the reply I got from the admin who installed Fedora on this machine.
When I was installing using yum, this was the error I got when I typed pecl install imagick:
php: relocation error: php: symbol SSLeay_version, version OPENSSL_1.0.1 not defined in file libcrypto.so.10 with link time reference
The instruction from this (http://jhalog.wordpress.com/2010/11/09/install-imagemagick-in-fedora-with-yum/) link usually works for me but not this time.
Then I tried to install imagick from source, I did not get any error but still PHP is unable to recognize it. I tried to run 'make test' and again the error above displayed.
Running 'php -m | grep imagick' also displays the above error message.
I don't have any advanced knowledge in Linux so I will appreciate any help.
I am not getting what you problem really is, but this may help you. you dont have to download source file, extract, configure, make , make install, make test, install magick wand etc etc. Just follow the commands below,
First of all remove everything you have tried to make it work. Uninstall ImageMagick with the following command:
sudo apt-get remove imagemagick
Remove ImageMagick and all its dependencies with the following command:
sudo apt-get remove auto-remove imagemagick
Purge the config file of ImageMagick with the following command:
sudo apt-get purge imagemagick
Or similarly, like this:
sudo apt-get purge auto-remove imagemagick
Well, all your previous installation files are just gone. Now Install it purely and perfectly without any conflict or file modification. Enter the following two commands:
sudo apt-get install imagemagick
sudo apt-get install php5-imagick
That was way too easy a thanks interwebs! Remember to restart/reload your webserver..
sudo service apache2 graceful
That's all. Check your php.ini or test with any simple script. For simple scripts to test ImageMagick you can refer to this post.
I have installed ImageMagick using brew install imagemagick. This all worked fine and I can run any ImageMagick command from the Terminal / Command line.
Now when I try to use the ImageMagick classes in PHP, I get an error Class 'Imagick' not found in .... I guess this is because the ImageMagick module is not loaded.
Could anyone help me to get this thing working in PHP? Thanks!
Additional info:
Mac OS X Version: 10.8: Mountain Lion
PHP Version: 5.3.13
I just did this after a lot of experimenting. For now, this seems to be the way to do it for php 5.3:
brew tap josegonzalez/php
brew tap homebrew/dupes
brew install php53-imagick
No idea who Jose Gonzalez is but apparently we are in his debt....
php72-imagick is now deprecated as imagick is part of php binary itself. Use pecl to install imagick e.g.:
brew install php
brew install imagemagick
brew install pkg-config
pecl install imagick
Your ImageMagick installation is not enough. You also need the Imagick package (possibly called php72-imagick or similar for home brew).
Imagick doesn't do the work itself, it is a native PHP extension for creating and modifying images using the ImageMagick API.
Try to search for the exact name of the package via brew search imagick.
I'm using Yosemite. For me, the solution is a combination of the answer and comment already listed here.
brew install imagemagick
brew install php55-imagick
Edit /etc/php.ini to include imagick
extension=/usr/local/Cellar/php55-imagick/{version of php55-imagick}/imagick.so
Example:
extension = /usr/local/Cellar/php55-imagick/3.1.2_1/imagick.so
I had the same issue. These are the steps that worked for me if you are using php 5.6
brew install php56-imagick
brew install imagemagick
find /usr/local/Cellar -name "imagick.so"
copy the path from the output of this command into your php.ini file
e.g. extension=/usr/local/Cellar/php56-imagick/3.3.0_2/imagick.so
save your file. Now to double check that the imagemagick class exists type
php -r "print(class_exists('imagick'));"
Brew symlinking wasn't working for me so I had to put the full pathname into the php.ini file to get it to work.
Hope this helps
this one worked for me:
brew install imagemagick # If it's not already installed
mkdir /usr/local/lib/php/pecl # On my system this dir didn't exist and this caused pecl install to fail
pecl install imagick
here
Try:
brew install homebrew/php/php53-imagick
I've looking for correct way to install imagick on Mojavie and found solution that fully worked.
brew install imagemagick#6
brew install php#7.1
Install headers (Xcode-select --install)
Download imagick source code from: https://pecl.php.net/package/imagick
Open terminal and enter unzipped folder imagick-3.4.3/imagick-3.4.3 (in my case)
Run command phpize
./configure
make
And now if error occurs like MagicWand not found, edit file Makefile and look for CPPFLAGS = -I/usr/local/opt/imagemagick#6/include/. Inspect if in include folder there is no other folder. In my case it should be like this:
CPPFLAGS = -I/usr/local/opt/imagemagick#6/include/ImageMagick-6
save and return to terminal and type make (after finished)
sudo make install
imagick.so is located in imagick-3.4.3/imagick-3.4.3/modules
Ok after 1 hour at this I have figured it out. The mac is not giving the pecl script permissions to make a PHP directory. To resolve do as follows.
brew install imagemagick
Sudo pecl install imagick .
php --ini | grep "Loaded Configuration File"
Add extension=imagick.so under extensions.
The install will be complete. Then, to test run:
php -r "print(class_exists('imagick'));"
From: php error: Class 'Imagick' not found
Did you add extension=imagick.so to your php.ini (or /etc/php.d/imagick.ini) file?
I had the same error having already installed imagemagick and php71-imagick.
brew upgrade imagemagick - did the trick for me.
You may need sudo:
sudo brew upgrade imagemagick
You may need to restart apache / php-fpm / <other webserver>.
I cannot add comments because of reputation, but to add to this anwser:
answered Apr 12 at 16:52
Grzegorz Miśkiewicz
I was getting a missing php.h file, so as per Installing xdebug on MacOs Mojave - 'php.h' file not found I installed the necessary file via the below command:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /