Home >Backend Development >PHP Tutorial >How to Solve \'SSLRead() return error -9806\' When Making Curl POST Requests to HTTPS URLs on OSX 10.10?
OSX 10.10 Curl POST to HTTPS URL: Troubleshooting SSLRead() Error
After upgrading to OSX 10.10 Yosemite, users have encountered an error when performing Curl POST requests to SSL URLs. The error message "Error Number:56, Error String:SSLRead() return error -9806" indicates a problem with the SSL connection.
Upon investigation, it has been discovered that this error is related to the version of cURL that is compiled with PHP under Yosemite. By default, PHP uses cURL's SecureTransport, which may encounter issues with websites that have disabled SSLv3 due to the POODLE vulnerability.
To resolve this issue, you will need to install a version of PHP that utilizes OpenSSL instead of SecureTransport for cURL. This can be done through Homebrew, a package manager for macOS. After installing Homebrew, follow these steps:
Tap the Homebrew taps:
$ brew tap homebrew/dupes $ brew tap homebrew/versions $ brew tap homebrew/php
Install curl with openssl:
$ brew install --with-openssl curl
Install PHP using the newly installed curl and openssl:
$ brew install --with-homebrew-curl --with-httpd24 php55
Once you have completed these steps, run the following command:
$ php -i | grep "SSL Version"
You should now see:
SSL Version => OpenSSL/1.0.2h
With OpenSSL being used for cURL, the SSLRead() error should no longer occur when you attempt Curl POST requests to HTTPS URLs.
The above is the detailed content of How to Solve \'SSLRead() return error -9806\' When Making Curl POST Requests to HTTPS URLs on OSX 10.10?. For more information, please follow other related articles on the PHP Chinese website!