• Register
0 votes

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
    fwrite($fp, $this->request);
    while($line = fgets($fp)){
        if($line !== false){
            $this->response .= $line;

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.

7.5k points

1 Answer

0 votes

Solution :

I was on my CentOS 7 and my php installation was pointing to the certificate that was generated by using update-ca-trust. And the symlink was /etc/pki/tls/cert.pem and was pointing to /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem. This was just my test server and I wanted my self signed cert to work properly. So in my case as follows

# My root ca-trust folder was on below path and. I copied the .crt file to this location
# and also renamed it to a .pem
# After that run following command and it should regenerate the certs for you and
#will include your selfsigned cert file.also

After doing this some of my api calls started working as my cert was now trusted. After that I just ran the following command man update-ca-trust .

36.1k points

Related questions

1 vote
1 answer 16 views
Problem : I am very new to wget. Currently I want to wget to my current box but I am facing below error: wget http://example.com --2013-03-01 15:03:30--  http://example.com/ Resolving example.com... Connecting to example.com||:80... ... it and tried to find solution on it. But unable to do so as I am very new to wget. I need expert help to fix by above wget error.
asked Apr 16 stewart 4k points
0 votes
1 answer 107 views
Problem : I am having trouble with my website. It has been slowed down a little in last couple of days. I have carefully looked into my error log & found a lots of following logs: [Sat Nov 30 00:09:53 2019] [error] [client] Request ... core.c(3126): [client] redirected from r->uri = /images/2019/02/600x376_0.076827001313237200_pixnaz_ir_1.jpg How to solve this issue?
asked Nov 30, 2019 alecxe 7.5k points
0 votes
2 answers 500 views
Problem: I am attempting to download records from a https webpage and continue getting the accompanying error: OpenSSL: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure Unable to establish SSL connection. From perusing sites online I assemble I need to give ... alternative however that didn't work. wget version: wget-1.13.4 openssl version: OpenSSL 1.0.1f 6 Jan 2014
asked Nov 30, 2019 alecxe 7.5k points
0 votes
1 answer 16 views
Problem : I have recently upgraded my PHP on Apache. Before upgrading everything was good. But after I upgraded my server PHP I am regularly facing the below error with my latest PHP Version 5.6.2 on Apache 2.0. A PHP Error was encountered Severity: Notice Message ... returned by reference Filename: core/Common.php Line Number: 257 What could have caused the above error? How can I fix this error?
asked Feb 14 mphil 2.3k points
0 votes
1 answer 17 views
There was a problem i am having following issue: confirming the ssl certificate: [ssl: tlsv1_alert_protocol_version] Can anyone suggest what is wrong?
asked Jul 22 James Martin 1.3k points