PHP 5.6 SoapClient verify_peer With Self-Signed Certificate

Norah O'Donnell non sequitur

Norah O’Donnell non sequitur


By default, PHP 5.6 has verify_peer enabled for openssl connections. So if you use the SoapClient to connect via SSL to a soap server, you’ll likely see “Could not connect to host” connection failures.

To fix this, you need to generate some certificates on the server running your PHP applications and making the Soap calls.

You will need create a self-signed certificate, if you don’t already have one.

I’m running Ubuntu, so I followed these instructions.

What you’re doing is creating your own internal certificate authority and then generating a new certificate that you’ll link to in your php.ini.

On my server, I created a file in /etc/php5/apache2/conf.d/30-openssl.ini and put this in it.

[openssl]
openssl.cafile=/etc/ssl/certs/ca-certificates.crt
Share Button