gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 18:36:11 30 4
gpt4 key购买 nike

当我尝试使用 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/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com