简体   繁体   English

cURL不适用于https给php提供77错误

[英]cURL not working for https giving 77 error in php

I updated my curl to work on https. 我更新了curl,使其可以在https上使用。 It does work on terminal however when I use cUrl in php it doesn't work for any https based url. 它确实可以在终端上运行,但是当我在php中使用cUrl时,它不适用于任何基于https的url。

The error code i get is 77. I have looked into other solutions but no solution is working at all. 我得到的错误代码是77。我已经研究了其他解决方案,但根本没有解决方案。

I have already tried adding verifyHost, SSL v 6, return transfer nothing works 我已经尝试添加verifyHost,SSL v 6,返回传输无用

A simple code is 一个简单的代码是

$ch = curl_init("https://www.google.com");

        $response = curl_exec($ch);

        $error = curl_error($ch);
        $number = curl_errno($ch);

        curl_close($ch);

        $response = array(
            'Result' => array(
                'error'=> $error,
                'number' => $number,
                //'message'=>$fields,
                'count'=> $response
            ));
        $this->jsonOutput($response);  

In terminal curl https://www.google.com works fine. 在终端curl https://www.google.com可以正常工作。

What is going on, the curl in php was working just fine before. 发生了什么,php中的curl之前工作得很好。

As you are using yum, i assume you are working on a CentOS distro. 当您使用yum时,我假设您正在开发CentOS发行版。

I have made a brief research and it seems it could be an issues with the NSS centos package, triggered by your yum update . 我进行了简短的研究,似乎是由您的yum update触发的NSS centos软件包的问题。 You could try some basic process restart. 您可以尝试一些基本的过程重启。

Try to restart your httpd service: 尝试重新启动您的httpd服务:

service httpd restart

Or via apache: 或通过apache:

apachectl stop
apachectl start

and your php-fpm 和你的php-fpm

sudo service php-fpm restart

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM