ImageMagick shows no supported file types so WordPress plugins don't work

Erik Fraser 25 Reputation points
2024-07-11T22:12:57.6966667+00:00

I have a basic Azure App Service Web App running WordPress on PHP 8.2.20. I have a plugin that fails to upload files, and after some research I think it may be due to the fact that ImageMagick is showing that it has no supported file types.

First, why would this be the case on a standard installation?

Second, how does one fix it in Azure App Service? Every way the Internet recommends does not work as the App Service is very locked down and you can't run most of the commands required to reinstall ImageMagick.

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

2 answers

Sort by: Most helpful
  1. ajkuma 28,021 Reputation points Microsoft Employee Moderator
    2024-07-15T18:00:47.0966667+00:00

    Erik Fraser, Apologies for the delayed response from over the weekend.

    What is the exact error message that you receive installing the plugin? Are you leveraging App Service Windows or Linux?

    PHP 8.x images are pre-built with imagick extension. It will pull the latest available version of imagick when a new tag is available following the App Service OS and runtime patching times.

    Just to highlight, ImageMagick best practices strongly encourages you to configure a security policy that suits your local environment.

    If you desire to modify these policies on Azure App Service Linux, the best option to accomplish this will be to use a startup script.

    Here is an example for removing policies for ghostscript:

    #!/bin/bash
      #Removing ghostscript policies
      sed -i '/disable ghostscript format types/,+6d' /etc/ImageMagick-6/policy.xml
      #Update Ghostscript
      apt-get update && apt-get install -y ghostscript
      service nginx reload
    
    
    

    And then update the startup script location from Azure Portal:

    User's image


  2. Erik Fraser 25 Reputation points
    2024-07-15T22:23:31.7633333+00:00

    An update: A colleague has added a new app service instance to the app service plan we are using, and he made it PHP-based instead of WordPress-based. In that instance, Imagick is showing 247 supported file types, so I think this new instance will work. I do think it might be a good idea for MS to investigate why a standard WordPress-based app service can't properly use Imagick, as a lot of WordPress plugins use it.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.