How to install php7.4-gd in App Platform container?

Posted October 6, 2020 3.9k views
PHPDockerDigitalOcean App Platform

Is there a way to install php7.4-gd in the default container build step?

I´ve tried:

sudo apt-get install -y php7.4-gd

Unfortunately I´m getting an error:

sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?

Without sudo:

E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

You can install the GD extension by adding ext-gd to composer.json like so:

    "require": {
        "ext-gd": "*"

The PHP build environment uses the Heroku PHP Buildpack, so you can refer to the official documentation for more information.