What to do if php curl returns error code 60

藏色散人
Release: 2023-03-12 10:52:02
Original
4846 people have browsed it

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
Copy after login

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

cURL error 60 错误
curl code ERROR 60错误
Copy after login

Cause of error:

curl is being configured Turning on certificate verification

means using the following configuration

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
Copy after login

Solution:

Method 1:

curl Close the certificate Verification

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
Copy after login

Method 2:

Use cacert.pem

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

Example, code:

curl.cainfo = "D:\php\cacert.pem"
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template