大网数据广告活动
服务器运维问答

Updated cURL not taking effect in PHP

· 52CE 我爱测

I have an application running through Docker, based on the official PHP Docker image . I've extended it to update cURL and get it working with nghttp2 and openssl , which is what I need for HTTP/2 support in my application. Howev…

问题原文

原帖链接 · Mark Locker · CC BY-SA 3.0

I have an application running through Docker, based on the official PHP Docker image.

I've extended it to update cURL and get it working with nghttp2 and openssl, which is what I need for HTTP/2 support in my application.

However, PHP itself isn't reflecting the change, and I don't know why.

Here's my Dockerfile:

FROM php:7.0.3-fpm

# Add sources that allow installation of unstable packages (needed for latest OpenSSL/cURL versions).
RUN echo 'deb http://ftp.uk.debian.org/debian testing main contrib \n\
deb-src http://ftp.uk.debian.org/debian testing main contrib \n\
deb http://ftp.debian.org/debian/ jessie-updates main contrib \n\
deb-src http://ftp.debian.org/debian/ jessie-updates main contrib \n\
deb http://security.debian.org/ jessie/updates main contrib \n\
deb-src http://security.debian.org/ jessie/updates main contrib' > /etc/apt/sources.list \
&& apt-get update

# Install OpenSSL, nghttp2 and cURL (required to make HTTP/2 requests).
RUN apt-get install -y openssl nghttp2 curl

# Install other dependencies.
RUN apt-get install -y \
    libfreetype6-dev \
    libjpeg62-turbo-dev \
    libmcrypt-dev \
    libpng12-dev \
&& docker-php-ext-install pdo_mysql mbstring sockets zip bcmath \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install gd

# Copy custom PHP.ini
COPY php.ini /usr/local/etc/php/

# Run php-fpm.
CMD ["php-fpm"]

curl --version outputs:

curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.9 zlib/1.2.8 libidn/1.29 libssh2/1.4.3 nghttp2/1.7.1 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets

openssl version outputs:

OpenSSL 1.0.2f  28 Jan 2016

However, php -i outputs:

curl

cURL support => enabled
cURL Information => 7.38.0
Age => 3
Features
AsynchDNS => Yes
CharConv => No
Debug => No
GSS-Negotiate => No
IDN => Yes
IPv6 => Yes
krb4 => No
Largefile => Yes
libz => Yes
NTLM => Yes
NTLMWB => Yes
SPNEGO => Yes
SSL => Yes
SSPI => No
TLS-SRP => Yes
HTTP2 => No
GSSAPI => Yes
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps,     ldap, ldaps, pop3, pop3s, rtmp, rtsp, scp, sftp, smtp, smtps, telnet, tftp
Host => x86_64-pc-linux-gnu
SSL Version => OpenSSL/1.0.1k
ZLib Version => 1.2.8
libSSH Version => libssh2/1.4.3

Note that cURL Information shows the wrong curl version number, and HTTP2 is marked as no.

Any suggestions on how to get PHP to pick this up would be greatly appreciated!

已采纳解答

原帖链接 · Mark Locker · CC BY-SA 3.0

For anyone who wonders about this in the future, I did find a way to do it in the end. I basically created my own Docker image, heavily based on the official PHP one, that downloaded the newer version of cURL before compiling.

It's available on Docker hub (for PHP 7 running via FPM, at least).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-02-16)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。