Install Imagick extension for PHP 8 in macOS Big Sur
I am really grateful I’ve had a chance to have the Mac mini M1 on a new year 2021. It’s really fast, even I only use 8 gigs ram version! Also, the software that in my old mac no longer can use its latest update – like php with homebrew – is back! In this post, I will show you how to install imagick for PHP 8 in macOS Big Sur for it.
First, I assume that you already have Homebrew installed. Next is install PHP 8, we can use shivammathur/php for it, the installation steps are in its readme.
When PHP 8 installed, we can ensure that imagemagick already installed, if not, if we can install via Homebrew as well:
$ brew install imagemagick
Now, time to install imagick. There is no imagick release yet for php 8, but we can install the dev-master
already following this issue :
$ git clone https://github.com/Imagick/imagick $ cd imagick $ phpize && ./configure $ make $ sudo make install
When you run make
, if you got the following error:
/opt/homebrew/Cellar/php/8.0.0_1/include/php/ext/pcre/php_pcre.h:23:10: fatal error: 'pcre2.h' file not found
You can copy installed pcre2.h
from Homebrew:
cp /opt/homebrew/Cellar/pcre2/10.36/include/pcre2.h .
Next, you can re-run :
$ make $ sudo make install
After it installed, you can register imagick.so
to /opt/homebrew/etc/php/8.0/php.ini
:
extension="imagick.so"
Now, let’s check if it is installed:
➜ ~ php -a Interactive shell php > echo phpversion('imagick'); @PACKAGE_VERSION@
Yes, above @PACKAGE_VERSION@
should be just fine. That’s it!
5 comments