ImageMagick on PHP 8

PHP 8 now supports ImageMagick. Is there a way for me to update my PHP 8 installation so that it includes it?

Or will the ImageMagick compatible version of PHP 8 come baked into Local soon?

Hey @ddegner ā€“ Welcome to the Local Community Forums, and thanks for bringing this up!

Local doesnā€™t have an easy way to update the PHP service, but we do have some work lined up to improve our Lightning Services (the various server processes like PHP,MySQL,Nginx/Apache) and Iā€™ve made a note to include adding Imagick with the PHP 8 work.

I donā€™t have an exact ETA for when this will be release, but in order to streamline communication, Iā€™ve moved this topic to our ā€œFeature Requestsā€ category so that it can be up-voted to help determine the priority for getting this done!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Issue Summary

Absence of Imagick causing plugin issues.

Troubleshooting Questions

As everyone is aware by now, Imagick is still NOT included in php 8.x for Local. I have come across a few major plugins, the most prominent being Imagify which no longer work on a local site due to the missing library.

Downgrading to PHP 7.x or below is not an option, and other posts on this forum are either outdated or do not provide a working answer. Iā€™ve tried adding the Imagick dll manually, but to no avail.

Developers, please tell me if there is a reliable way to install/enable imagick for PHP 8.x

With newly installed Local 6.5.2 on Mac OS Catalina I have missing ImageMagick PHP module error in 7.* version line as well (7.3.5, 7.4.30).
It breaks some WordPress plugins and is a regression.

Iā€™m on Linux Mint 21.1, using Local 6.6.0. Installed sites report no imagic module present. I installed imagemagic and php imagic systemwide and tried to add path to the module in php.ini.hbs file but no joy here unfortunately. Is there a way to add systemwide imageic module?

Seconding this. Given it was working in the PHP 7.4 installation itā€™s effectively a regression.

Weā€™re targetting PHP 8.0 now because obviously WP-Engine (and everybody else) is going to be forcing us there soon and not being able to test or run code that requires imagick under PHP 8.0 is proving to be a brick wall for us.

If itā€™s not seen as a priority to add this back in officially, weā€™d be very grateful if someone could semi-officially document the steps required for us to add this back into the PHP 8.0 build ourselvesā€¦ even if that meant our installation was (for now) unsupported.

Thanks!

Bug Summary

The currently bundled PHP libraries have dropped the imagick module

Steps to reproduce

Either:

  • in WordPress check the WP core Tools->SiteHealth & note the complaint from WP about the missing module (https://i.imgur.com/J7OJMRQ.png)
    or
  • attempt to run a theme or plugin that performs image manipulation and note the error
    or
  • select ā€œPHP versionā€ in Local as 8.0.22 or 8.1.9, click apply, then click details. Note that ā€œimagickā€ is not found in the generated phpinfo page

Environment Info

  • Debian 11
  • nginx, PHP 8.0.22/8.1.9, MySQL 8.0.16
  • Local 6.7.0+6347

Supporting info

Following on from a support comment on another recent thread:

Agreed, our goal is that all of those PHP versions should be compiled with the same default set of extensions. Weā€™ll make sure PDO support is added on all versions going forward!

And (I know Iā€™m repeating myself butā€¦) make sure that list of extensions includes imagick given that WP core now checks for that & complains if itā€™s not there and plenty of plugins and themes require that functionality.

Itā€™s currently not included in the bundled builds of PHP 8.0.22 or 8.1.9

I know that this has been brought up several times but it feels like itā€™s getting brushed aside a little. It would be great if we could get an acknowledgement of this & know if there are plans around correcting it because at the moment weā€™re migrating sites out of Local into other solutions in order to support clients that use this and need to be on PHP 8 - a ā€œyes we know and itā€™ll be in the builds for the next point releaseā€ or ā€œit might make it into the next major releaseā€ or ā€œweā€™ll add it to the todo list for future considerationā€ and a timeline would help us know how much effort we should be putting into this migration.

Donā€™t get me wrong - I am VERY grateful for how much Local has streamlined our WP development (in fact setting up alternative development environments is reminding me just how much itā€™s helped!) but a little feedback on the status here would go a long way. Our live sites on WP Engine all have it included - if youā€™re wanting to mimic the live site experience then itā€™s an odd thing to remove (and yes we have considered using a WP Engine environment directly for developmentā€¦ but itā€™s hardly ideal lol)

Thanks!

Jon

1 Like

While waiting I installed ImageMagick myself on macOS php 8.1.18 and linked to Local php 8.1.9. Itā€™s working now, so maybe it will help someone. I had homebrew and php 8.1 installed already.

Local terminal:

brew install pkg-config imagemagick
pecl install imagick

You should see something similar to 'Installing ā€˜/usr/local/Cellar/php@8.1/8.1.18/pecl/20210902/imagick.soā€™. This is the path we need.
Local /conf/php/php.ini.hbs:
Comment lines:

; {{#if intelChipMac}}
; [imagick]
; extension = {{extensionsDir}}/imagick.so
; {{/if}}

Add lines:

[imagick]
extension="/usr/local/Cellar/php@8.1/8.1.18/pecl/20210902/imagick.so"

Restarted Local site and php info now shows ImageMagick number of supported formats: 256.

@hmmux I tried your steps, but still getting the same errors.

This fixed my issue.

If you are using zsh, comment these lines under .zshrc file

#export PATH="/opt/homebrew/opt/php@8.0/bin:$PATH"
#export PATH="/opt/homebrew/opt/php@8.0/sbin:$PATH"

Our team really needs local wp to fix the imagick extension on php 8.1!! There are no replacements for the imagick extension for our purposes, and we are forced to update to php 8.1 from 7.4 due to security risks. Our last option is to wait for local wp now. Above solutions do not work @ben.turner @Nick-B

Hi @haydenrust1 - which operating system are you using? I can check with the team and see if we can port the work we recently did on PHP 8.2 back to PHP 8.1.

1 Like

@austinwendt I am on a mac os. Please see my personal post here for details on my setup: Imagick on PHP 8.1

Need a self install instructions for Windows 10 - I have the module but donā€™t know how to install it into Local 7.1.0

Any word yet?

@haydenrust1 and @drkanukie

Imagick should be available now for PHP 8.2 and weā€™ll get it added to prior versions soon.

1 Like

@Nick-B Thanks for the reply! Sadly our current stack doesnt allow us to use 8.2 yet, we are stuck with choosing either 8.0 or 8.1 and have landed on 8.1. Making this php switch is due to major security risks from staying on anything below 8.x. Unfortunately without imagick working on 8.1, we have to wait to release this update to production and have to sit in this scary limbo state. I know you said soon, but what kind of timeline are you planning? End of next week? A couple days? A month? Time is against us here and we really need this ASAP. Thank you for all the work you guys are doing!

Hi @haydenrust1 - thanks for the extra info. More for my curiosity - can you explain what youā€™re using Imagick for, and how it is a blocker in the development of the site? Does it generate errors on the site? What are you seeing when it is missing?

Agreed, I donā€™t want you staying in a scary limbo state. On getting Imagick working on Apple Silicon Macs in PHP 8.1 - realistically, I imagine it will be a month. We have a few other things weā€™re working on that we need to finish with PHP 8.2 before we can go back to lower versions.

Another option in the short-term - if you download the Intel macOS build, PHP 8.1.9 has Imagick compiled/linked but it also has issues we need to address. Iā€™m not sure what errors youā€™re running into, but it is possible running the Intel version (which will be compatible with your machine) would resolve them?