PHP stream_socket_client fails to connect

I am trying to contact a url via php’s stream_socket_client() command which is failing with no error code or msg. Does this use openssl, curl or something else? The site uses https and works fine from a web browser.

enter image description here

When I call openssl directly it connects but appears unahppy with my certificate chain.

root@drupal7 drupal7/includes# openssl s_client -connect test.cgps.org:443
CONNECTED(00000003)
Verify return code: 21 (unable to verify the first certificate)

Same with curl

curl https://test.cgps.org/?q=/admin/config/search/clean-urls/check
curl: (60) SSL certificate problem: unable to get local issuer certificate

So I figured I needed to install the intermediate cert into Linux which I did by placing the same intermediate cert Apache uses into /usr/local/share/ca-certificates and running update-ca-certificates.

root@drupal7 drupal7/includes# update-ca-certificates
Updating certificates in /etc/ssl/certs... 1 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d....done.

Still no luck…

Leave a comment