[英]PHP | "The requested PHP extension bcmath is missing from your system."
[英]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.
运行composer install
(我们的 composer 版本是 1.10.17)时,我在一些必需的软件包上收到以下错误:
您的系统中缺少请求的 PHP 扩展 gd
我在我们的gitlab-ci.yml
上尝试了几件事:
apt-get update -yqq
apt-get install -yqq libpng-dev
但这也产生了同样的错误。
我还尝试从composer.json
文件中要求ext-gd
:
composer require ext-gd
但我得到了这个错误:
您的系统中缺少请求的 PHP 扩展 ext-gd ^7.1。 安装或启用 PHP 的 gd 扩展。
我做的最后一次尝试是:
apt-get install php-common
phpenmod gd
但这给了我这个错误:
无法找到 package php-common
有谁知道如何简单地启用 PHP 扩展 gd 以便我可以运行我的单元测试?
当我将它添加到我的gitlab-ci.yml
文件时,我修复了错误:
...
before_script:
- apt-get update -yqq
- apt-get install libjpeg-dev libpng-dev -yqq
- docker-php-ext-install gd
...
您需要 PHP GD 库。 For Debian and Debian based systems, eg Ubuntu, as well as Debian based Docker containers use:
apt-get install -qy php-gd
如果仍然不清楚,或者您有旧/其他系统,只需搜索
apt-cache search php gd
并将找出可能的 package 候选者。
对于 Docker 容器,您似乎需要不同的路线,所以 Dockerfile:
FROM php:7.1-apache-buster
RUN apt-get update
RUN apt-get upgrade -qqy
RUN php -v
RUN apt-get install -qy libpng-dev
RUN docker-php-ext-install gd
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.