Azure linux web app service enable webP image support (PHP Version 7.4.28)?

Douglas Fabiano de Oliveira 6 Reputation points
2022-07-26T14:25:32.423+00:00

Hi everyone!

I'm facing a problem when trying to convert a JPG image to WEBP using the imagewebp function in PHP. The error response is "Call to undefined function imagewebp()".

After a lot of research, I see that it's necessary to enable the WebP Support in my linux web app. This image shows all the GD extension that I have enabled. Do you know how can I enable the WebP Support to make the function imagewebp() work?

224876-gd-support.png

I execute the command below in SSH/kudu that I found in google, but without success :/

Command:
apt-get update && apt-get install -y libwebp-dev && docker-php-ext-configure gd --with-freetype-dir=/usr --with-png-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-vpx-dir=/usr && docker-php-ext-install gd

Error:
/usr/src/php/ext/gd/libtool: line 1283: libgd/gd.loT: No such file or directory
mkdir libgd/.libs
mkdir: cannot create directory 'libgd/.libs': No such file or directory
make: *** [Makefile:197: libgd/gd.lo] Error 1

Thank you very much for any directions ;)

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
{count} votes

1 answer

Sort by: Most helpful
  1. Dmitry Prokhorenko 11 Reputation points
    2023-04-21T13:53:03.2066667+00:00

    You have mistake in your steps u need next

    1. open for edit startup.sh (can do it on console) (this file) User's image

    and add to this file next (for php8.1)

    apt-get update && apt-get install -y libfreetype6-dev \
                    libjpeg62-turbo-dev \
                    libpng-dev \
                    libwebp-dev \
            && docker-php-ext-configure gd --with-freetype --with-webp  --with-jpeg
    docker-php-ext-install gd
    
    1. restart u azure web app

    User's image

    and after restart, go to console and run command php --ri gd and u can look this User's image

    after this u must be happy )

    1 person found this answer helpful.

Your answer

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