php - Docker安装cURL失败(需要7.10.5以上版本)

标签 php docker curl docker-compose dockerfile

当我尝试使用 dockercomposer.json 安装 Stripe 时遇到错误。

这是我的 composer.json:

{
"require": {
    "smarty/smarty": "^3.1",
    "stripe/stripe-php": "^6.13"
    }
}

我的 Dockerfile

FROM php:7.2.6-apache
RUN docker-php-ext-install mysqli curl

以及当我docker-compose up

时的错误日志
Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20170718/
Installing header files:          /usr/local/include/php/
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la       modules/* libs/*
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20170718
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.16 (ok)
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for cURL support... yes, shared
checking for pkg-config... /usr/bin/pkg-config
checking for libcurl.pc... using default path
checking for cURL 7.10.5 or greater... configure: error: cURL version 7.10.5 or later is required to compile php with cURL support
ERROR: Service 'www' failed to build: The command '/bin/sh -c docker-php-ext-install mysqli curl' returned a non-zero code: 1

我找不到任何修复方法,或者我做错了什么。感谢帮助

最佳答案

“docker-php-ext-install”帮助脚本旨在安装 PHP 扩展,而不是系统包。在您的 Dockerfile 中,您将需要如下内容:

FROM php:7.2.6-apache
RUN apt-get update -y && apt-get install -y curl && apt-get clean -y
RUN docker-php-ext-install mysqli

mysqli 是一个 PHP 扩展,所以应该没问题。 (我建议使用 PDO,但那是另一回事。)

关于php - Docker安装cURL失败(需要7.10.5以上版本),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56027785/

相关文章:

php - Mailgun 发送带附件的邮件

php - cURL/PHP 请求在 50% 的时间内执行

php - Scope - 如何从 laravel excel import 返回错误?

php - Jpgraph:如何手动设置 X 轴和 Y 轴的范围

python-3.x - 如何修复 python3 中的 CVE-2019-19646 Sqlite 漏洞

java - 在 docker 中为 docker-client for java 设置容器端口

php - Paypal 访问 - SSL 证书 : unable to get local issuer certificate

php - 如何使用php从特定文件夹中获取所有图片和视频?

php - 如何在 Twig 基础模板中设置基于 session 的变量?

docker - 无法在Docker中推送图像