How to install ImageMagick PHP extension via SSH

July 1, 2024 / Security and Backups

This article explains how to install the ImageMagick PHP extension via SSH. After creating your website, you may require the ImageMagick PHP extension for advanced image processing, particularly if you are using PHP web applications like WordPress or Laravel.

Steps to install ImageMagick PHP extension via SSH:

  1. Download the Imagick source
    /opt/cpanel/ea-php83/root/usr/bin/pecl download imagick
    tar xvzf imagick-3.8.0.tgzcd imagick-3.8.0
  2. Ensure the build environment points to ImageMagick 7
    Most ImageMagick 7 installations place .pc files in /usr/local/lib/pkgconfig.

    export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

    (Critical: without this, the build will incorrectly bind to system ImageMagick or fail to detect MagickWand.)

  3. Prepare the PHP build environment
    Use EA-PHP’s phpize

    /opt/cpanel/ea-php83/root/usr/bin/phpize
  4. Configure the build
    Point Imagick to ImageMagick 7 AND the correct EA-PHP83 php-config:

    ./configure \
    --with-imagick=/usr/local \
    --with-php-config=/opt/cpanel/ea-php83/root/usr/bin/php-config
  5. Clean and compile
    make clean
    make -j"$(nproc)"
  6. Install the extension
    make install
  7. This will drop imagick.so into:
    /opt/cpanel/ea-php83/root/usr/lib64/php/modules/

If you are not a tech expert and want to increase the functionality of your website, you can Install ImageMagick and Imagick on cPanel Server. This will help to enhance your image-handling capabilities

If you encounter any issues, feel free to contact our support staff.

Spread the love