ddev: Unable to use GD AVIF file format support

Is there an existing issue for this?

  • I have searched the existing issues

Run a Diagnostic and Paste Link Here

OS Information: Darwin MacBook-Pro-M1-de-Alban.local 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000 arm64
ProductName:    macOS
ProductVersion: 12.6
BuildVersion:   21G115
User information: uid=501(albanjubert) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae)
DDEV version:  ITEM             VALUE                                   
 DDEV version     v1.21.1                                 
 architecture     arm64                                   
 db               drud/ddev-dbserver-mariadb-10.4:v1.20.0 
 dba              phpmyadmin:5                            
 ddev-ssh-agent   drud/ddev-ssh-agent:v1.20.0             
 docker           20.10.11                                
 docker-compose   v2.9.0                                  
 docker-platform  colima                                  
 mutagen          0.15.1                                  
 os               darwin                                  
 router           drud/ddev-router:v1.20.0                
 web              drud/ddev-webserver:20220808_yarn_crash 
PROXY settings: HTTP_PROXY='' HTTPS_PROXY='' http_proxy='' NO_PROXY=''
======= DDEV global info =========
Global configuration:
instrumentation-opt-in=true
omit-containers=[]
mutagen-enabled=true
nfs-mount-enabled=false
router-bind-all-interfaces=false
internet-detection-timeout-ms=3000
disable-http2=false
use-letsencrypt=false
letsencrypt-email=
table-style=default
simple-formatting=false
auto-restart-containers=false
use-hardened-images=false
fail-on-hook-fail=false
required-docker-compose-version=
use-docker-compose-from-path=false
no-bind-mounts=false

======= DOCKER info =========
docker location: lrwxr-xr-x  1 albanjubert  admin  36 May 30 08:49 /opt/homebrew/bin/docker -> ../Cellar/docker/20.10.16/bin/docker
Docker Desktop Version: Docker Desktop for Mac 4.12.0 build 85629
docker version: 
Client: Docker Engine - Community
 Version:           20.10.16
 API version:       1.41
 Go version:        go1.18.2
 Git commit:        aa7e414fdc
 Built:             Wed May 11 16:22:17 2022
 OS/Arch:           darwin/arm64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.11
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.4
  Git commit:       847da184ad5048b27f5bdf9d53d070f731b43180
  Built:            Fri Nov 19 03:41:34 2021
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          v1.5.8
  GitCommit:        1e5ef943eb76627a6d3b6de8cd1ef6537f393a71
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:        
DOCKER_DEFAULT_PLATFORM=notset
======= Mutagen Info =========
Mutagen is installed in ddev, version=0.15.1
--------------------------------------------------------------------------------
Name: craft4-playground
Identifier: sync_4bePEGUlFaJfpIWL4mTdMdN77NaeAXwnDCRFW4yMGFP
Alpha:
        URL: /Users/albanjubert/Documents/htdocs/craft4-playground
        Connected: Yes
Beta:
        URL: docker://79375e5bc14252acef8baad1ac6dd1f68f13ebafe71f604a529fa3231ce69e49/var/www/html
                DOCKER_HOST=unix:///Users/albanjubert/.colima/default/docker.sock
        Connected: No
Status: Connecting to beta
--------------------------------------------------------------------------------
mutagen additionally installed in PATH at /usr/local/bin/mutagen, version 0.11.8
mutagen is running on this system:
  501  2686     1   0  1:00PM ??         0:15.45 mutagen daemon run
  501  5014  4989   0  2:45PM ttys004    0:00.00 grep mutagen
======= Docker Info =========
Docker platform: colima 
Colima version: 0.4.6 
Using docker context: default (unix:///Users/albanjubert/.colima/default/docker.sock) 
docker-compose: v2.9.0 
Using DOCKER_HOST=unix:///Users/albanjubert/.colima/default/docker.sock 
Docker version: 20.10.11 
Able to run simple container that mounts a volume. 
Able to use internet inside container. 
Docker disk space:
Filesystem                Size      Used Available Use% Mounted on
overlay                  58.8G     41.2G     14.5G  74% /

unable to create project at project root '/Users/albanjubert/Documents/htdocs/tryddevproject-10516': project root /Users/albanjubert/Documents/htdocs/tryddevproject-10516 does not exist
The ddev-ssh-agent container has been removed. When you start it again you will have to use 'ddev auth ssh' to provide key authentication again.
Existing docker containers: 
CONTAINER ID   IMAGE          COMMAND                  CREATED        STATUS                    PORTS     NAMES
c5e48f789c8c   c22ad8fdf04b   "sh -c 'chown -R 501…"   4 months ago   Exited (0) 4 months ago             recursing_einstein
689b1eb71f75   8219b1a570b2   "sh -c 'chown -R 501…"   4 months ago   Exited (0) 4 months ago             dreamy_mirzakhani
Creating a new ddev project config in the current directory (/Users/albanjubert/Documents/htdocs/tryddevproject-20720) 
Once completed, your configuration will be written to /Users/albanjubert/Documents/htdocs/tryddevproject-20720/.ddev/config.yaml
 
Found a php codebase at /Users/albanjubert/Documents/htdocs/tryddevproject-20720/web 
Could not write settings file: Mutagen sync session 'tryddevproject-20720' does not exist 
Configuration complete. You may now run 'ddev start'. 
Network ddev_default created 
Starting tryddevproject-20720... 
Container ddev-ssh-agent  Started 
ssh-agent container is running: If you want to add authentication to the ssh-agent container, run 'ddev auth ssh' to enable your keys. 
Pushed mkcert rootca certs to ddev-global-cache/mkcert 
Network ddev-tryddevproject-20720_default  Created 
Volume "tryddevproject-20720_project_mutagen"  Created 
Container ddev-tryddevproject-20720-db  Started 
Container ddev-tryddevproject-20720-web  Started 
Container ddev-tryddevproject-20720-dba  Started 
Starting mutagen sync process... This can take some time. 
Mutagen sync flush completed in 1s.
For details on sync status 'ddev mutagen status tryddevproject-20720 --verbose' 
Container ddev-router  Started 
Successfully started tryddevproject-20720 
Project can be reached at https://tryddevproject-20720.ddev.site https://127.0.0.1:49202 
======== Curl of site from inside container:
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 13 Oct 2022 12:46:09 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding

======== Curl of site from outside:
HTTP/1.1 200 OK
Server: nginx/1.20.1
Date: Thu, 13 Oct 2022 12:46:09 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding

======== Project ownership on host:
ls: /Users/albanjubert/tmp/tryddevproject-20720: No such file or directory
======== Project ownership in container:
drwxr-xr-x 4 albanjubert dialout 4096 Oct 13 12:46 /var/www/html
======== In-container filesystem:
Filesystem                     Type 1K-blocks     Used Available Use% Mounted on
/dev/disk/by-label/data-volume ext4  61610796 43439744  15008992  75% /var/www
Success accessing database... db via TCP/IP

Expected Behavior

When running the following PHP code, an AVIF file test.avif should be generated:

if (function_exists('imageavif')) {
    echo "OK";
    $image = imagecreatetruecolor(250, 250);
    imageavif($image, 'test.avif');
}

Actual Behavior

Calling imageavif or imagecreatefromavif functions results in an warning: imageavif(): AVIF image support has been disabled

Steps To Reproduce

Execute a php command involving imageavif or imagecreatefromavif

Anything else?

Though PHP GD AVIF support is enabled in DDEV, it looks like the underlying libs to handle AVIF files on the GD side are missing causing the issue. Trying to add libavif-bin, libavif9 or libavif-dev along with php8.1-gd to webimage_extra_packages doesn’t solve the issue.

There is an interesting post about this issue here: https://php.watch/versions/8.1/gd-avif However, the solution involve to compile PHP 8.1, which seems not very suited in DDEV web container context.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 26 (18 by maintainers)

Most upvoted comments

Looks like progress in https://github.com/oerdnj/deb.sury.org/issues/1641#issuecomment-1288883679 but he’ll push it with the next php patch release, and of course DDEV will pick it up in a release. When he pushes it, and you want to pick it up, I imagine you’ll be able to get it with webimage_extra_packages: [php8.1-fpm]

@rfay Same here, still get the AVIF image support has been disabled error message using the script provided in the issue. apt install reports php8.1-gd is already the newest version (8.1.12-1+0~20221028.28+debian11~1.gbpc35f51). though. So, looks like this is not sorted out on deb.sury.org yet 😦

Interested in whether this has started to work yet in DDEV v1.22.0-beta3, or whether it will work when we update the ddev-webserver base image to Debian 12 bookworm.

I experimented with this some more in https://github.com/rfay/aviftest, you may want to spend a little more time with it, and the README there has some more links. Seems to me like it’s closer than it was, maybe you can get it over the finish line. But the version there installs the newer packages.

I didn’t see any workarounds in https://bugs.php.net/bug.php?id=81217 ?

I’m pretty sure that what has to happen to get forward progress is to do a build of gd that actually does what you want.

In https://stackoverflow.com/a/60683558/215713 there’s a beginning approach to building a pecl extension yourself, and you can do the steps manually as opposed to in Dockerfile, but the advantage of Dockerfile is you don’t lose your work when you ddev restart.

I think the first question is: “Can anybody get this to work in any context? How?” The second question is “How can we get this packaged for Debian so it works” and the third is “How can we get it into DDEV?”

See

Please mention your issue there and ask again for progress.

I think it may require some exploration in the PHP world. The ddev-webserver is Debian 11, and you can experiment with anything Debian. The base PHP images are all from https://github.com/oerdnj/deb.sury.org - you can build pecl extras using the techniques in