Home>Article>Backend Development> What to do if php curl returns error code 60

What to do if php curl returns error code 60

藏色散人
藏色散人 Original
2021-09-03 10:47:42 4729browse

Solution to the error code 60 returned by php curl: 1. Curl turns off certificate verification; 2. Reference the cacert.pem file in the php.ini configuration file of php.

What to do if php curl returns error code 60

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

What to do if php curl returns error code 60 ?

php curl error 60 error solution:

Today a user encountered the following error when calling a curl method. I searched for some information. Finally solved. Record the solution and keep it for yourself to refer to later.

Error code

cURL error 60: SSL certificate problem: unable to get local issuer certificate

After customizing the takeover error output, it may be displayed as follows

cURL error 60 错误 curl code ERROR 60错误

Cause of error:

curl is being configured Turning on certificate verification

means using the following configuration

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);

Solution:

Method 1:

curl Close the certificate Verification

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

Method 2:

Use cacert.pem

Reference this file in the php.ini configuration file of php

Example, code:

curl.cainfo = "D:\php\cacert.pem"

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What to do if php curl returns error code 60. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn