Install ImageMagick/imagick PHP extension on CyberPanel/OpenLiteSpeed! — CyberPanel - WebHosting Control Panel for OpenLiteSpeed
CyberHosting

Install ImageMagick/imagick PHP extension on CyberPanel/OpenLiteSpeed!

edited June 3 in Tutorials

Deprecated: This guide is now deprecated. You can now install ImageMagick for PHP 5.6,7.0,7.1,7.2,7.3,7.4 from PHP>Install extensions. Follow this instruction http://docs.cyberpanel.net/doku.php?id=php-extensions .

Update on 25th August

ImageMagick is now available in LiteSpeed official repo and can be installed using

yum install lsphpXX-pecl-imagick

Replace XX with PHP version. You can also use the instructions below but they are not needed anymore.

Prerequisites

To install ImageMagick/imagick php extension you need a package called ImageMagic-devel, you can install from yum

yum install ImageMagick-devel -y

You also need php devel package, gcc and make:

yum install lsphp72-devel make gcc

Download imagick

imagick packages are available at https://pecl.php.net/package/imagick

You can download the latest version, current latest version is 3.4.3.

Note: We are installing it for PHP 7.2, process is similar for other php versions.

cd 
wget https://pecl.php.net/get/imagick-3.4.3.tgz
tar zxf imagick-3.4.3.tgz

Installation

cd imagick-3.4.3
/usr/local/lsws/lsphp72/bin/phpize
./configure --with-php-config=/usr/local/lsws/lsphp72/bin/php-config
make
make install

Then open your php.ini file which is located at /usr/local/lsws/lsphp72/etc/php.ini and append following at the end:

extension=/usr/local/lsws/lsphp72/lib64/php/modules/imagick.so

Now restart OpenLiteSpeed:

systemctl restart lsws

Comments

  • FAILED TEST SUMMARY
    ---------------------------------------------------------------------
    Test Imagick, subImageMatch [tests/151_Imagick_subImageMatch_basic.phpt]
    Test PECL bug #20636 [tests/bug20636.phpt]
    =====================================================================
  • Yep, I get the same failed test summary
  • I follow the steps exactly and get no error, but the extension does not show up in the list of available extensions in CyberPanel, nor does WordPress make use of it.
  • Can confirm, it does not work!
  • Install the pecl imagick

    yum -y install lsphp72-pecl-imagick

    Following the instructions above will give you a module mismatch until you update the pecl modules.
    Cyberpanel Managed & Unmanaged Shared & VPS Hosting by Cyberpanel Experts.
    https://www.cyberhosting.org
    You can now earn with the Cyberhosting affiliate scheme. Join today
    https://www.cyberhosting.org/affiliates/
  • HI anyone successfully installed the imagick extension & got it working with WordPress !

    @usmannasir can this be added to inbuilt extension install section of cyberpanel in upcoming updates.
  • ImageMagick is now available in LiteSpeed official repo and can be installed using

    yum install lsphpXX-pecl-imagick

    Replace XX with PHP version. I will also update main article and add in the CyberPanel list.

    @cloudrider
  • In LiteSpeed repo, this package is available for PHP 5.6, 7.0, 7.1, 7.2 and 7.3.

    I added to CyberPanel PHP Extension installer and pushed the package (works for new installs, others can use the command above and restart LiteSpeed)
  • Hi @CyberPanel

    Can you let me know how I can enable the local webp conversion support with the now included imagick extension.

    I was trying to enable webp support with LScache plugin but it was not working, then landed on this github link.

    https://github.com/rosell-dk/webp-convert/wiki/Installing-Imagick-extension-with-WebP-support

    Any idea how I can enable webp images support for WordPress sites. :neutral:
  • Hi @CyberPanel
    Any idea how I can enable webp images support for WordPress sites. :neutral:

    One option is to use GraphicsMagick with the WebP Express plugin.
    yum install GraphicsMagick
  • Thanks @jayw

    I'll try that out.
  • Can you please update the guide?
    There is currently a libMagickWand.so.5 library error.
  • There is no need to update the guide. Imagemagik is now supplied as a PHP extension by litespeed. If there is an error you need to address that with litespeed.
    Cyberpanel Managed & Unmanaged Shared & VPS Hosting by Cyberpanel Experts.
    https://www.cyberhosting.org
    You can now earn with the Cyberhosting affiliate scheme. Join today
    https://www.cyberhosting.org/affiliates/
  • Can you write how to solve it in Centos?
  • Not for the little information you have given. What PHP version are you attempting?

    did you check PHP -i to see if it is actually installed or not?
    Cyberpanel Managed & Unmanaged Shared & VPS Hosting by Cyberpanel Experts.
    https://www.cyberhosting.org
    You can now earn with the Cyberhosting affiliate scheme. Join today
    https://www.cyberhosting.org/affiliates/
  • yum install lsphp71-pecl-imagick
    Wczytane wtyczki: fastestmirror, product-id, search-disabled-repos, subscription-manager

    This system is not registered with an entitlement server. You can use subscription-manager to register.

    Loading mirror speeds from cached hostfile
    * base: centos.hitme.net.pl
    * epel: ftp.icm.edu.pl
    * extras: centos1.hti.pl
    * updates: centos.hitme.net.pl
    Rozwiązywanie zależności
    --> Wykonywanie sprawdzania transakcji
    ---> Pakiet lsphp71-pecl-imagick.x86_64 0:3.4.4-2.el7.7.1 zostanie zainstalowany
    --> Przetwarzanie zależności: libMagickWand.so.5()(64bit) dla pakietu: lsphp71-pecl-imagick-3.4.4-2.el7.7.1.x86_64
    --> Przetwarzanie zależności: libMagickCore.so.5()(64bit) dla pakietu: lsphp71-pecl-imagick-3.4.4-2.el7.7.1.x86_64
    --> Ukończono rozwiązywanie zależności
    Błąd: Pakiet: lsphp71-pecl-imagick-3.4.4-2.el7.7.1.x86_64 (litespeed-update-mirror)
    Wymaga: libMagickCore.so.5()(64bit)
    Błąd: Pakiet: lsphp71-pecl-imagick-3.4.4-2.el7.7.1.x86_64 (litespeed-update-mirror)
    Wymaga: libMagickWand.so.5()(64bit)
    Można spróbować użyć --skip-broken, aby obejść problem
    Można spróbować wykonać polecenie: rpm -Va --nofiles --nodigest
  • Try

    /usr/local/lsws/lsphp71/bin/pecl install imagick

    and then add the extension to

    /usr/local/lsws/lsphp71/etc/php.ini

    and restart lsws
    Cyberpanel Managed & Unmanaged Shared & VPS Hosting by Cyberpanel Experts.
    https://www.cyberhosting.org
    You can now earn with the Cyberhosting affiliate scheme. Join today
    https://www.cyberhosting.org/affiliates/
  • Can I also install on versions 5.6 and 7.0?
  • The method I just posted should work on all versions.
    Cyberpanel Managed & Unmanaged Shared & VPS Hosting by Cyberpanel Experts.
    https://www.cyberhosting.org
    You can now earn with the Cyberhosting affiliate scheme. Join today
    https://www.cyberhosting.org/affiliates/
  • edited June 3
    You no longer need to do this. You can install it from install php extensions.
    https://your_hostname:8090/managephp/installExtensions
This discussion has been closed.
CyberPanel Discord

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!