PHPのcURLでHTTPSリクエストを行うとセグメンテーション違反でエラーになる

PHP 5.2 で cURL を利用してHTTPSリクエストしようとしたところ《セグメンテーション違反》になりました。

原因は、PHPのcURLがSSL通信に OpenSSL ではなく、 NSS を利用していた為

どうやらCentOS 6のRPM版cURLでは、標準でNSS APIを利用するようになったみたいです。

しょうがないのでソース版のcURLをSSL API指定でインストールします。

configure の最後に詳細が表示されるので、 SSL support が OpenSSL になっていることを確認しておきます。

curl version: 7.45.0
Host setup: i686-pc-linux-gnu
Install prefix: /usr/local
Compiler: gcc
SSL support: enabled (OpenSSL)
SSH support: enabled (libSSH2)
zlib support: enabled
GSS-API support: no (–with-gssapi)
TLS-SRP support: no (–enable-tls-srp)
resolver: default (–enable-ares / –enable-threaded-resolver)
IPv6 support: enabled
Unix sockets support: enabled
IDN support: enabled
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
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)
HTTP2 support: disabled (–with-nghttp2)
Protocols: DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS POP3 POP3S RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP

あとは make でインストール。

その後のPHPのインストール時に下記のオプションをお忘れなく‥。

–with-openssl=/usr/local/openssl \
–with-kerberos \
–with-curl=/usr/local/lib \
–with-curlwrappers \

確認してみます。

これでOK。
エラーも消えました。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です