WordPress has been yelling at me for a while that I don’t have the PHP module imagick installed. When I moved to an updated server running AL2023 and PHP 8, I lost it. As it turns out the reason is that the package isn’t included, and that hasn’t changed since 2022. Mildly annoying!
I found a re:Post guide (thanks Mike Lim!) on setting up PHP modules and followed that with some slight modifications/reordering:
sudo dnf install -y ImageMagick ImageMagick-devel
sudo dnf install -y php-devel php-pear gcc
sudo pecl update-channels
sudo pecl install imagick
At this point, in checking that the shared library was successfully installed to /usr/lib64/php8.2/modules/ I noticed that the new file wasn’t marked executable like all the others. Pretty sure that’s necessary?
sudo chmod +x /usr/lib64/php8.2/modules/imagick.so
Then for enabling the module, since my php.d had numbered prefixes and comments, I tweaked the config a bit:
sudo tee /etc/php.d/30-imagick.ini > /dev/null << EOF
; Enable the ImageMagick extension module
extension=imagick.so
EOF
After restarting php-fm I confirmed on my Site Health report in the admin panel that ImageMagick is good to go.
sudo systemctl restart php-fpm
php -m | grep -i imagick
I’m hoping this might resolve some of the performance issues I’ve had on image upload.
While ideally this is the sort of thing that should just be handled by the distribution/image, probably instead of poking at my live VPS I should follow all the best practices I use at work and set up some sort of containerized WordPress pipeline, huh?
What do you think?