Skip to content

Instantly share code, notes, and snippets.

@ryanscherler
Last active August 16, 2018 20:06
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save ryanscherler/fea4bb75379c1564df7e027c45615cc9 to your computer and use it in GitHub Desktop.
Save ryanscherler/fea4bb75379c1564df7e027c45615cc9 to your computer and use it in GitHub Desktop.
Use Homebrew PHP with OpenSSL instead of SecureTransport

This issue is noted here: https://deliciousbrains.com/wp-migrate-db-pro/doc/ssl-errors/

Original reference for this fix is from: http://stackoverflow.com/questions/26461966/osx-10-10-curl-post-to-https-url-gives-sslread-error/26538127#26538127

Check OpenSSL version

php -i | grep "SSL Version"

You'll likely see this:

SSL Version => SecureTransport

Swap with OpenSSL via Homebrew

brew uninstall php71-mcrypt
brew uninstall php71
brew install --with-openssl curl
brew install --with-homebrew-curl php71
brew install php71-mcrypt

Check OpenSSL version

php -i | grep "SSL Version"
SSL Version => OpenSSL/1.0.2j
@hasandz
Copy link

hasandz commented Sep 20, 2017

If you got "Cannot find libz" errors when installing php71. Run the command below and try again.

xcode-select --install

@4lg4
Copy link

4lg4 commented Jan 3, 2018

don't forget to uninstall curl at first
brew uninstall curl

@netbull
Copy link

netbull commented Feb 6, 2018

for me was enough just to reinstall curl and php72 and it worked like a charm :)

Thanks!

@raptor235
Copy link

@netbull can you post your php.ini file.. I've just spent a few hours trying all different options and just cannot get openssl to show up as ssl version in php... curl is showing

$ curl -V
curl 7.59.0 (x86_64-apple-darwin16.7.0) libcurl/7.59.0 OpenSSL/1.0.2o zlib/1.2.8 libidn2/2.0.4

but php is showing 7.54.0 running 7.2

also when installing php via brew --with-openssl is ignored these days.. I'm stuck at this point don't know what to do.

@rinseringma
Copy link

@raptor235 Same problem here. Any solutions yet?

@toddhuish
Copy link

@raptor235 @rinseringma I found the solution! Not mine but some helpful soul on the internet. I just did it and the following happened...finally!

SSL Version => OpenSSL/1.0.2o

https://medium.com/this-old-code/installing-php-7-2-bc779b23dce8

@THER-K
Copy link

THER-K commented Jun 10, 2018

@toddhuish, thank you so much!!!!!

@tekamolo
Copy link

tekamolo commented Jul 5, 2018

@toddhuish sadly this is not working for me.

@jjwdesign
Copy link

I finally had success after many hours. I'm not sure if it was the order in which I uninstalled or installed brews, but I finally got it to work using the method over at "this-old-code" mentioned above. I'm not sure if my ~/.bash_profile changes made a different or not, but I'm posting them here for others. This was recommended by for the compiler after the "brew reinstall curl".

export PATH="/usr/local/opt/curl/bin:$PATH"
LDFLAGS: -L/usr/local/opt/curl/lib
CPPFLAGS: -I/usr/local/opt/curl/include
PKG_CONFIG_PATH: /usr/local/opt/curl/lib/pkgconfig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment