skip to Main Content

Imagick extension works perfectly in PHP.8.1 and Laravel 10 but not in PHP 8.2, the new Laravel 11 works with php 8.2 that means the library must be installed too to works… but I could not find how to install Imagick in PHP 8.2, I understand Imagick is pre-installed in PHP 8.2.17 but .dll is not in ext folder… so.. How can I prepare to work with Laravel 11, PHP 8.2, Intervention Image, Imagick in local using Laragon, XAMPP or WAMPP? and the same in production using Ubuntu 22?

thanks for help…

I am trying to use Laravel 11 with PHP 8.2 and Intervention to process images

2

Answers


  1. sudo apt-get install php8.2-imagick -y
    

    Then restart the server

    Login or Signup to reply.
  2. EDIT: the following guide works if a DLL for the PHP version exists, and while official Imagick Build does exist for PHP 8.1.27 on Windows for PHP 8.2 it doesn’t at the moment. I would suggest trying to use Docker with Alpine, PHP 8.2 and Imagick, there is on StackOverflow a thread that might help you: Imagick Docker Alpine Linux php8.2
    or if you can take the risk, download non-official Imagick DLL for php 8.2 from https://github.com/Imagick/imagick/issues/573#issuecomment-1431773928

    That being said the steps are:

    To know if php is Thread Safe or not, and what architecture is it (x86, x64), to discover this in PowerShell:

    php -i | Select-String "Thread Safety"
    php -i | Select-String "Architecture"
    

    Then go to http://pecl.php.net/package/imagick and download the package, for example for php 8.1.27 I currently have: 8.1 Thread Safe (TS) x64 imagick 3.7.0

    Unzip the content of the package in a folder that can be definitive.

    Copy the one dll (php_imagick.dll in my case) to your php ext directory and make sure you right click on the file, properties and unblock it.

    Now to make it work you need to:

    1. Edit php.ini

    In php.ini, find where extensions are defined searching for extension= and add the line:

    extension:imagick
    

    2. Edit PATH sys env variable to add Imagick folder

    Search PATH on startbar, open "Edit the system environment variables", click on Environment Variables, select PATH, edit and add the path to the Imagick definitive folder.

    Done.

    Now you should be able to see imagick extension in a new opened console when you digit "php -m"

    Beware: if you do not add Imagick folder PATH to your system env path php will like throw an error of extension not found even if the dll is there.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search