# curl请求HTTPS网站时返回错误码77

**URL:** <https://www.shiqidu.com/t/topic/517>\
**Category:** 开发调优\
**Tags:** cURL\
**Created:** [2018 年11 月 23 日 06:09 UTC](https://www.shiqidu.com/t/topic/517 "2018-11-23T06:09:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

作者： ![Leon](https://www.shiqidu.com/user_avatar/www.shiqidu.com/leon/32/5_2.png) [@Leon](https://www.shiqidu.com/u/Leon)\
发布日期： [2018 年11 月 23 日 06:09 UTC](https://www.shiqidu.com/t/topic/517/1 "2018-11-23T06:09:12Z")

</div>

在curl请求一个HTTPS网站时，没有返回内容，curl\_error没有返回错误信息，curl\_errno返回错误码为77。

发生这种问题是因为本地服务器的ca证书有问题。

> CURLE\_SSL\_CACERT\_BADFILE (77) – 读取 SSL CA 证书时遇到问题（可能是路径错误或访问权限问题）

解决方法

1. 重新安装下ca证书

```bash
 sudo yum install ca-certificates

```

1. 重启php-fpm

```bash
/etc/init.d/php-fpm restart

```

1. 更改下发送curl的代码

```php
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

```
