Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
610 views
in Technique[技术] by (71.8m points)

GitLab PHP docker image - the requested PHP extension gd is missing from your system

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?

question from:https://stackoverflow.com/questions/65598594/gitlab-php-docker-image-the-requested-php-extension-gd-is-missing-from-your-sy

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I fixed the errors when I added this to my gitlab-ci.yml file:

...
before_script:
  - apt-get update -yqq
  - apt-get install libjpeg-dev libpng-dev -yqq
  - docker-php-ext-install gd
... 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...