Home >Backend Development >PHP Tutorial >Why Does My Curl POST to HTTPS URL Fail with SSLRead() Error on OSX 10.10?

Why Does My Curl POST to HTTPS URL Fail with SSLRead() Error on OSX 10.10?

Susan Sarandon
Susan SarandonOriginal
2024-11-02 22:57:301066browse

Why Does My Curl POST to HTTPS URL Fail with SSLRead() Error on OSX 10.10?

OSX 10.10 Curl POST to HTTPS URL Returns SSLRead() Error

This issue arises when PHP is compiled with a cURL version that utilizes Apple's Secure Transport in Yosemite, and the target HTTPS URL lacks SSLv3 support—a measure taken due to the POODLE vulnerability.

To verify if this is indeed the cause, execute the following command:

$ php -i | grep "SSL Version"

You're likely to encounter the following output:

SSL Version => SecureTransport

To resolve the issue, install a PHP version that employs a cURL version leveraging OpenSSL rather than SecureTransport. You can seamlessly accomplish this using Homebrew.

  1. Install Homebrew if not already present. Update it and ensure you have XCode 6.1 or later with the latest XCode command line tools.
  2. Tap the Homebrew repositories:

    • $ brew tap homebrew/dupes
    • $ brew tap homebrew/versions
    • $ brew tap homebrew/php
  3. Install curl with OpenSSL:

    • $ brew install --with-openssl curl
  4. Install PHP using the newly installed openssl curl:

    • $ brew install --with-homebrew-curl --with-httpd24 php55
    • Replace httpd24 with your Apache version if applicable.
  5. Configure for Apache/Nginx:

    • Apache: Append LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so to your httpd.conf and restart Apache.
    • Nginx (Caveat):

      • Start fpm:

        • mkdir -p ~/Library/LaunchAgents
        • cp /usr/local/opt/php55/homebrew.mxcl.php55.plist ~/Library/LaunchAgents/
        • launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
  6. Install necessary PHP extensions, e.g., $ brew install php55-mcrypt.
  7. Re-run the php -i | grep "SSL Version" command to confirm the change:

    • SSL Version => OpenSSL/1.0.2h

Upon executing these steps, the SSLRead() error should no longer persist.

The above is the detailed content of Why Does My Curl POST to HTTPS URL Fail with SSLRead() Error 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