I’m writing some unit tests for our application and we’re using GitLab CI with GitLab Runner v11.11.1 and using Docker executor with image php:7.1.
When running composer install
(our composer version is 1.10.17) I get the following error on a few required packages:
the requested PHP extension gd is missing from your system
I’ve tried a couple things like on our gitlab-ci.yml
:
apt-get update -yqq
apt-get install -yqq libpng-dev
But that also produced the same error.
I also tried requiring ext-gd
from the composer.json
file:
composer require ext-gd
But I got this error:
The requested PHP extension ext-gd ^7.1 is missing from your system. Install or enable PHP’s gd extension.
The last attempt I made was:
apt-get install php-common
phpenmod gd
But this gave me this error:
Unable to locate package php-common
Does anyone know how to simply enable the PHP extension gd so I can run my unit tests?
2
Answers
I fixed the errors when I added this to my
gitlab-ci.yml
file:You need PHP GD library. For Debian and Debian based systems, e.g. Ubuntu, as well as Debian based Docker containers use:
If it’s still unclear, or you have older/other system just search
and will find out possible package candidates.
For Docker containers it seems you need a different route, so Dockerfile: