Home  >  Article  >  Backend Development  >  How to Solve \"SSLRead() return error -9806\" When Making Curl POST Requests to HTTPS URLs on OSX 10.10?

How to Solve \"SSLRead() return error -9806\" When Making Curl POST Requests to HTTPS URLs on OSX 10.10?

Susan Sarandon
Susan SarandonOriginal
2024-10-31 08:28:02350browse

How to Solve

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:

  1. Tap the Homebrew taps:

    $ brew tap homebrew/dupes
    $ brew tap homebrew/versions
    $ brew tap homebrew/php
  2. Install curl with openssl:

    $ brew install --with-openssl curl
  3. Install PHP using the newly installed curl and openssl:

    $ brew install --with-homebrew-curl --with-httpd24 php55
  4. Configure PHP for Apache or Nginx.
  5. Install any PHP extensions you require.

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn