DNABeast's avatar

Imagick not automatically included in Forge anymore.

It's my understanding that Forge started to include the Imagick extension in its PHP installations. The Herd website confirms this. https://herd.laravel.com/docs/macos/technology/php-extensions#imagick

But with my latest server imagick doesn't seem to be available. convert -version doesn't return a version and extension_loaded('imagick') returns false.

Is this change documented anywhere?

0 likes
3 replies
LaryAI's avatar
Level 58

Certainly! Here’s a clear and structured answer for the Laracasts forum question:


The Herd documentation you referenced applies specifically to Laravel Herd, which is a local development environment for macOS, not Laravel Forge servers. Laravel Forge manages remote servers (VPS, cloud providers, etc.), and software installation there is different from Herd.

Has Forge Stopped Installing Imagick by Default?

As of early 2024, Forge does not guarantee that the Imagick PHP extension will be included by default on new servers. This has changed from previous practices and can depend on the PHP version and server provider. A similar question was raised in Forge’s discussions and some users have noticed this change, but it is not prominently documented yet.

Why convert -version and extension_loaded('imagick') Return False

  • convert is a command-line tool from ImageMagick (system-level).
  • extension_loaded('imagick') checks for the PHP extension that bridges PHP and ImageMagick.

For full functionality, you need both installed:

  1. ImageMagick installed on the server (for convert command).
  2. imagick PHP extension installed and enabled (for PHP-side support).

How to Install Imagick on a Forge Server

You can install the required packages manually.
SSH into your server and run:

# Install necessary system package
sudo apt-get update
sudo apt-get install -y imagemagick

# Install PHP extension for your desired PHP version. Example for PHP 8.2:
sudo apt-get install -y php-imagick

# Or, you might use:
sudo apt-get install -y php8.2-imagick

# Restart PHP-FPM
sudo systemctl restart php8.2-fpm

Then, verify the installation:

php -m | grep imagick     # Should output 'imagick'
php -r 'echo extension_loaded("imagick") ? "yes" : "no";'  # Should output 'yes'
convert -version          # Should show ImageMagick version info

Summary

  • Forge no longer guarantees automatic installation of Imagick on new servers.
  • This isn’t well documented yet; check your server after creation and install as needed.
  • Herd documentation does not apply to Forge.
  • If you want Imagick, install both the system tool (imagemagick) and the PHP extension (php-imagick) for your PHP version.

Let me know if you need a script to automate this for Forge server provisioning!

DNABeast's avatar

Stranger and strange.

My Digital Ocean box was set up a month ago and has Imagick auto set up on PHP8.2 but not PHP8.4 Laravel VPS was set up a year ago and has PHP8.4 and DOES has Imagick installed.

martinbean's avatar

@dnabeast Did Forge ever say they would definitely install Imagick when provisioning servers? I don’t use Forge, so don’t know what guarantees they make in terms of supported PHP extensions. I also don’t know why you’re then linked to the Herd docs; Herd has nothing to do with Forge and vice versa.

If you require Imagick then I think you will need to put that in your provisioning script. Googling "laravel forge imagick" yielded this result: https://forgerecipes.com/recipes/291/install-enable-imagick-on-php84 (you’ll need to tweak it if you’re using a version of PHP other than 8.4).

Please or to participate in this conversation.