title: PHP stream_socket_client fails to connect
body: <p>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. </p>
  
  <p><a href="https://i.stack.imgur.com/lhY3x.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lhY3x.jpg" alt="enter image description here"></a></p>
  
  <p>When I call openssl directly it connects but appears unahppy with my certificate chain.</p>
  
  <pre><code>root@drupal7 drupal7/includes# openssl s_client -connect test.cgps.org:443
  CONNECTED(00000003)
  Verify return code: 21 (unable to verify the first certificate)
  </code></pre>
  
  <p>Same with curl</p>
  
  <pre><code>curl https://test.cgps.org/?q=/admin/config/search/clean-urls/check
  curl: (60) SSL certificate problem: unable to get local issuer certificate
  </code></pre>
  
  <p>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. </p>
  
  <pre><code>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.
  </code></pre>
  
  <p>Still no luck...</p>