■概要
タイトルの通り。
CentOS6.5で
curl --http2 -v https://http2bin.org/get
ができないためバージョンを上げたい。
curl -V
curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.15.3 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
【問題】
- nghttp2が有効になっていない
- CentOS6のvaultリポジトリでもcurlの最新は7.19.7-54.el6_10。今回7.33以上が必須となる
上記のため、ソースコードよりコンパイルする
※cURLの最新版はこの時点で7.81だったが、対象環境(CentOS6)ではコンパイルが通らなかったため、他環境で実績のあった7.58を利用した。
えっ……いろいろ言いたいことがあるのは理解しますがワークアラウンドとして。
■作業概要
# nghttp2インストール
yum install nghttp2 libnghttp2 libnghttp2-devel
# cURL7.58コンパイル
cd /usr/local/src/
wget --no-check-certificate https://curl.haxx.se/download/curl-7.58.0.tar.gz
tar xzvf curl-7.58.0.tar.gz
cd curl-7.58.0
./configure --prefix=/usr/local --with-ssl --enable-libcurl-option --with-nghttp2
# =====
# curl version: 7.58.0
# Host setup: x86_64-pc-linux-gnu
# Install prefix: /usr/local
# Compiler: gcc
# SSL support: enabled (OpenSSL)
# SSH support: no (--with-libssh2)
# zlib support: enabled
# brotli support: no (--with-brotli)
# GSS-API support: no (--with-gssapi)
# TLS-SRP support: no (--enable-tls-srp)
# resolver: POSIX threaded
# IPv6 support: enabled
# Unix sockets support: enabled
# IDN support: no (--with-{libidn2,winidn})
# Build libcurl: Shared=yes, Static=yes
# Built-in manual: enabled
# --libcurl option: enabled (--disable-libcurl-option)
# Verbose errors: enabled (--disable-verbose)
# SSPI support: no (--enable-sspi)
# ca cert bundle: /etc/pki/tls/certs/ca-bundle.crt
# ca cert path: no
# ca fallback: no
# LDAP support: no (--enable-ldap / --with-ldap-lib / --with-lber-lib)
# LDAPS support: no (--enable-ldaps)
# RTSP support: enabled
# RTMP support: no (--with-librtmp)
# metalink support: no (--with-libmetalink)
# PSL support: no (libpsl not found)
# HTTP2 support: enabled (nghttp2)
# Protocols: DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP
# =====
make
make install
curl -V
# curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.0.1e zlib/1.2.3 nghttp2/1.6.0
# Release-Date: 2018-01-24
# Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
# Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy
# 確認
curl --http2 -v https://http2bin.org/get
# phpのモジュール確認
php -i | grep cURL
# cURL support => enabled
# cURL Information => 7.19.7
# この時点では古いまま
# インストールされたusr/local/lib以下にldconfigでライブラリのパスを通す
echo '/usr/local/lib' > /etc/ld.so.conf.d/custom-libs.conf
ldconfig
# 確認
ldconfig -p | grep curl
# phpのモジュール再確認
php -i | grep cURL
# cURL support => enabled
# cURL Information => 7.58.0
OK