How can I install the php module Imagick on my webapps

Mario Bondici 21 Reputation points
2021-07-29T13:47:49.923+00:00

HI there

I'm trying to install the imagick php module in my wordpress webapp, but I can't found the right way to do it.

I'm working with

System: Windows NT RD00155D5758B8 10.0 build 14393 (Windows Server 2016) AMD64

Loaded Configuration File: D:\local\Config\PHP-7.4.15x64\php.ini

Thread Safety: disabled

Can anyone help me?

Thanks in advance

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,053 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Ryan Hill 26,316 Reputation points Microsoft Employee
    2021-07-31T21:27:14.153+00:00

    Hi @Mario Bondici ,

    Based on your PHP version, get the latest php_imagick.dll from https://windows.php.net/downloads/pecl/releases/imagick/

    • Unzip the folder and Copy all CORE_RL_* files to d:\home\site\ImageMagick\
    • Copy php_imagick.dll to d:\home\site\ext\
    • Create new applicationHost.xdt file inside the d:\home\site folder and copy the below configuration <?xml version="1.0"?>
      <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
      <system.webServer>
      <runtime xdt:Transform="InsertIfMissing">
      <environmentVariables xdt:Transform="InsertIfMissing">
      <add name="PATH" value="%PATH%;d:\home\site\ImageMagick" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
      </environmentVariables>
      </runtime>
      </system.webServer>
      </configuration>

    On your app service Application Settings:

    • Add an App Setting with the name MAGICK_CODER_MODULE_PATH and set value to d:\home\site\ImageMagick
    • Add an App Setting with the name MAGICK_HOME and set the value to d:\home\site\ImageMagick
    • Add an App Setting with the name PHP_INI_SCAN_DIR and set the value to d:\home\site\ext\
    • Add ImageMagick to .extensions.ini file in location: d:\home\site\ext; to create the extensions.ini file, see this blog post.
    • Restart the Web App and check the phpinfo page. It should return a imagick module section

    119527-image.png

    You should see the following phpinfo results:

    119490-image.png


  2. Mario Bondici 21 Reputation points
    2021-08-05T15:07:35.593+00:00

    Hi @Ryan Hill ,

    ok I solved adding a new configuration node in my web.config

       <staticContent>  
              <remove fileExtension=".webp" />  
              <mimeMap fileExtension=".webp" mimeType="image/webp" />  
       </staticContent>  
    

    Thanks