B
B
blantcat2018-02-05 15:06:50
PHP
blantcat, 2018-02-05 15:06:50

How to fix curl error "60: SSL certificate problem: self signed certificate in certificate chain"?

Good afternoon.
There is a script that crashes with a certificate error. (php-7.2-x64 + apache-php-7.2-x64)

$url = "https://oauth.vk.com/access_token?client_id=APP_ID&client_secret=APP_SECRET&code=7a6fa4dff77a228eeda56603b8f53806c883f011c40b72630bb50df056f6479e52a&redirect_uri=REDIRECT_URI";
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

$output = curl_exec($ch);
if ( ! $output) {
    print curl_errno($ch) .': '. curl_error($ch);
}

curl_close($ch);

Threw here d:\ospanel\modules\php\PHP-7.2-x64\ new https://curl.haxx.se/docs/caextract.html , but it didn't help.
I save myself like this: curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
Can you please tell me how to fix this error?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Baskakov, 2018-02-05
@dmitrybascacov

Simple to use:
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); //Auto redirect
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); //Disabling certificate verification
Why not satisfied with CURLOPT_SSL_VERIFYPEER ?

O
Oleg, 2020-09-28
@402d

You need to configure
curl.cainfo=
openssl.cafile=
.PEM file link https://curl.haxx.se/docs/caextract.html
don't forget to restart Apache

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question