How to enable WEBP image format support in PHP 7.*?

As title, I’ve used the following .travis.yml setting to build my CI environment.

language: php

php:
  - 7.1
  - 7.2
  - 7.3

before_script:
  - composer install

script:
  - mkdir -p build/logs
  - ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml

after_success:
  - travis_retry php vendor/bin/php-coveralls -v

But it’s undefined when using the imagewep function on every PHP version.

The detailed build log is available here.

And I use the Docker to build a container and it’s worked fine for the imagewebp function.

Here is my Dockerfile:

# Install required packages
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-get install -y python-software-properties
RUN LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
RUN apt-get update
RUN apt-get install -y apt-transport-https apt-utils curl php7.1-gd php7.1-cli

CMD ["bash", "-c", "php -r 'echo function_exists(\"imagewebp\");'"]

I think the default PHP versions in Travis CI build may have the webp image issues for GD extension.

Please help me to check/concern that :slight_smile:.

@peter279k I’m running into the same issue trying to test against WEBP/GD stuff that’s being skipped right now. Did you ever have any luck getting tests going?

1 Like

Hi @jarednova, thanks for your reply and concern :slight_smile: .

Unfortunately, this issue still happens on my Travis CI build and you can look at this repository.

It’s for testing this issue. As you can look at the Travis CI build log, the gd extension is loaded on PHP run time, but the imagewebp function is not existed.

@jarednova. If you want to fix this issue temporarily, you can look at another repository I create.

As you can look at Travis CI build log, this Travis CI build doesn’t use pre-built PHP versions and enable sudo to install remote PHP versions.

1 Like

Awesome, thanks @peter279k!!! I’ll take a look at those and see if I can pull that stuff into mine. Thanks for the quick response!

1 Like
Imprint