I need install imagick module on my php 7.2
I see
brew search php72
==> Searching local taps...
==> Searching taps on GitHub...
==> Searching blacklisted, migrated and deleted formulae...
No formula found for "php72".
Closed pull requests:
...
php72-imagick 3.4.3 (new formula) (https://github.com/Homebrew/homebrew-php/pull/4267)
How can I do it?
Also I need support for argon
It all changed back in April 2018 I think. Homebrew no longer acts as the package manager for PHP, so all the
php-imagick
andphp-redis
andphp-other-extension
stuff has gone and you are now supposed to manage PHP packages usingpecl
like everyone else does.So, how to get Imagick under PHP? Note that Imagick and ImageMagick are two different things:
Here are the steps - if anyone knows better or any improvements, let me know via comment and I will update.
Step 1 - Delete anything likely to conflict
Before starting, it is best to clean up all the stuff that is broken or unneeded. Do as many of these as you are comfortable with:
Step 2 - Update Xcode command line tools and get build packages
Make sure you have installed Xcode command-line tools with:
Go to AppStore and click on Updates and update any Xcode related packages - especially if you have recently upgraded macOS.
Install homebrew building tools:
Step 3 - Install ImageMagick
Check what ImageMagick options you want with:
I like to use:
but you may like vanilla install:
Step 4 - Install homebrew PHP
Next, install the homebrew version of PHP with:
Now, critically ensure you are running the correct homebrew PHP:
If that tells you:
you are running homebrew PHP and you can go to the next step.
If it tells you:
you are running the Apple-supplied PHP. If that is what you want to run, ignore my entire answer which is predicated on you wanting to use homebrew PHP. If you get this answer but want to run homebrew PHP, your PATH is set incorrectly. You need to put
/usr/local/bin
before/usr/bin
to pick up all homebrew packages ahead of Apple programs, i.e.This step gives you
pecl
- the PHP Package Manager - as well, since it is part of homebrew PHP.Step 5 - Install Imagick
Now you can install Imagick with
pecl
:If anything goes wrong, here are some related questions and answers...
Q1. How can I find where my
php.ini
file is?Try any of these commands:
Q2. How can I find where
pecl
installs modules?Q3. How can I tell what PHP modules are loaded?
Q4. Why can't PHP find my module?
First locate your modules directory using Q2. I like to put that in the clipboard with:
Then edit the
php.ini
file from Q1. I usevi
, so I would do:Then find the line in that file that looks like this:
and, then (using the contents of your paste buffer) make the following line look like this (no semi-colon at the start):
on my machine
XXXXXX
is20170718
. If you get this right, any and all modules you install viapecl
will be visible to your homebrew PHP.Q5. How can I see all my PHP settings?
Check PHP configuration, versions and settings with:
Hope that helps!
In my case (PHP 7.2.10 with Homebrew) works:
Open the file php.ini and remove extension line with imagick extension.
Check *.ini files with
You can see paths to extension files. Create or edit imagick ini file.
The content of file may be (check the path to imagick.so)
And restart php with
Try, if the error message dissapear:
And check imagick extension with:
If you see line with imagick module => enabled you have solved a problem.
You want
php72-gmagick
, GraphicsMagick is a fork from ImageMagick 5.5.2.Or, you can
pecl install imagick
still.