Problem :
I have upgraded to PHP 5.6 I am getting an error as follows whenever I am trying to connect to the server via fsockopen().
The certificate on the server or host is self signed.
PHP Warning: fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
My code as below
if($fp = fsockopen($host, $port, $errno, $errstr, 20)){
$this->request = 'POST '.substr($this->url, strlen($this->host)).' HTTP/1.1'.$crlf
.'Host: '.$this->host.$crlf
.'Content-Length: '.$content_length.$crlf
.'Connection: Close'.$crlf.$crlf
.$body;
fwrite($fp, $this->request);
while($line = fgets($fp)){
if($line !== false){
$this->response .= $line;
}
}
fclose($fp);
}
Have tried following
# cd /etc/ssl/certs/
# wget http://curl.haxx.se/ca/cacert.pem
The php.ini
openssl.cafile = "/etc/ssl/certs/cacert.pem"
But the script is still failing to work as expected.