php with curl ssl error: unsupported protocol

2019-07-19 18:39发布

When I run a php test script trying to connect to the Rackspace API over https using curl and my Macports php installation I get an unsupported protocol error (with curl verbose set to true). See below:

AndyMac:test Andy$ which php
/opt/local/bin/php
AndyMac:test Andy$ php test.php 
* About to connect() to lon.auth.api.rackspacecloud.com port 443 (#0)
*   Trying 212.64.148.13...
* connected
* Connected to lon.auth.api.rackspacecloud.com (212.64.148.13) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: /opt/local/share/curl/curl-ca-bundle.crt
  CApath: none
* error:14077102:SSL routines:SSL23_GET_SERVER_HELLO:unsupported protocol
* Closing connection #0
AndyMac:test Andy$ 
AndyMac:test Andy$ php -i | grep -i ssl
/opt/local/var/db/php5/openssl.ini,
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
SSL => Yes
SSL Version => OpenSSL/1.0.1
SSL => supported
openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.0.1 14 Mar 2012
OpenSSL Header Version => OpenSSL 1.0.0d 8 Feb 2011
OpenSSL support => enabled
AndyMac:test Andy$

As you can see php is compiled with ssl support. If I run the test script using the default install of php on my Mac then it works so there appears to be something wrong with the php Macports installation. Also it seems if I get other https urls using curl with the Macports php install I am able to get a response.

Any suggestions?

标签: php ssl curl
0条回答
登录 后发表回答