如何强制PHP的cURL扩展使用OpenSSL而不是GnuTLS?

时间:2017-09-10 08:07:13

标签: php openssl travis-ci php-curl gnutls

I have a PHPUnit testsuite正在我的本地计算机上成功传递,但在Travis CI上失败。

我已经确定测试因使用GnuTLS而不是OpenSSL的cURL扩展而失败,而且我不知道如何强制它使用OpenSSL。

我得到的错误是:

cURL error 56: GnuTLS recv error (-9): A TLS packet with unexpected length was received. (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

我试图按照here提供的说明进行操作,但由于我无法远程访问Travis实例,因此不断上传不同的配置并等待它们运行会令人沮丧每一次。

查看Travis系统信息,我可以看到以下内容:

Operating System Details
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:    14.04
Codename:   trusty

openssl version
OpenSSL 1.0.1f 6 Jan 2014

curl version
curl 7.35.0 (x86_64-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3

phpenv versions
  system
  5.4
  5.4.45
  5.5
  5.5.38
  5.6
* 5.6.31 (set by /home/travis/.phpenv/version)
  7.0
  7.0.22
  hhvm
  hhvm-stable

所以我知道安装了OpenSSL,cURL安装了OpenSSL,PHP运行在5.6.31。

我的输出也是php -i

PHP Version => 5.6.31

System => Linux testing-gce-67e44fc2-4ca1-49ef-abc8-08830fe54ccc 4.4.0-93-generic #116~14.04.1-Ubuntu SMP Mon Aug 14 16:07:05 UTC 2017 x86_64

Build Date => Jul 22 2017 11:49:03

Configure Command =>  './configure'  '--with-config-file-path=/home/travis/.phpenv/versions/5.6.31/etc' '--with-config-file-scan-dir=/home/travis/.phpenv/versions/5.6.31/etc/conf.d' '--prefix=/home/travis/.phpenv/versions/5.6.31' '--libexecdir=/home/travis/.phpenv/versions/5.6.31/libexec' '--enable-intl' '--with-openssl' '--without-pear' '--with-gd' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-freetype-dir=/usr' '--enable-exif' '--enable-zip' '--with-zlib' '--with-zlib-dir=/usr' '--with-mcrypt=/usr' '--with-pdo-sqlite' '--enable-soap' '--enable-xmlreader' '--with-xsl' '--enable-ftp' '--with-tidy' '--with-xmlrpc' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-shmop' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--enable-pcntl' '--with-readline' '--enable-mbstring' '--with-curl' '--with-pgsql' '--with-pdo-pgsql' '--with-gettext' '--enable-sockets' '--with-bz2' '--enable-bcmath' '--enable-calendar' '--with-libdir=lib' '--enable-fpm' '--enable-maintainer-zts' '--with-gmp' '--with-imap' '--with-imap-ssl' '--with-kerberos' '--with-ldap' '--with-ldap-sasl' '--enable-dba' '--with-cdb' '--with-mysql=mysqlnd'

curl
cURL support => enabled
cURL Information => 7.35.0
Age => 3
Features
AsynchDNS => Yes
CharConv => No
Debug => No
GSS-Negotiate => Yes
IDN => Yes
IPv6 => Yes
krb4 => No
Largefile => Yes
libz => Yes
NTLM => Yes
NTLMWB => Yes
SPNEGO => No
SSL => Yes
SSPI => No
TLS-SRP => Yes
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtmp, rtsp, smtp, smtps, telnet, tftp
Host => x86_64-pc-linux-gnu
SSL Version => GnuTLS/2.12.23
ZLib Version => 1.2.8

openssl

OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.0.1f 6 Jan 2014
OpenSSL Header Version => OpenSSL 1.0.1f 6 Jan 2014
Openssl default config => /usr/lib/ssl/openssl.cnf

Directive => Local Value => Master Value
openssl.cafile => no value => no value
openssl.capath => no value => no value

如何让SSL Version成为OpenSSL/1.0.1f而不是GnuTLS/2.12.23

0 个答案:

没有答案