Coder Social home page Coder Social logo

Comments (1)

v-tawe avatar v-tawe commented on August 10, 2024

It's a troubleshooting article, so I still use the format just like "issue----solution";
And due to the article is too simple, I add the content about "Why me meet the error" and "some discription about CA which we use in solution" to rich the article. Please help me to confirm whether it's suitable.

PHP调用认知服务证书认证问题

问题描述

在使用 PHP 的 http 客户端工具(如 Guzzle)调用认知服务时出现证书认证问题,错误信息如下:

Fatal error: Uncaught exception 'GuzzleHttp\Exception\RequestException' with message 'cURL error 60: SSL certificate problem: unable to get local issuer certificate

解决方法

此问题的出现是由于没有配置信任的服务器 HTTPS 验证。默认, cURL 被设为不信任任何 CAs,因此,这就是无法访问相关服务器的原因。解决该问题的最好方法是指定一组默认的受信任的 CAs。

  • CA证书
    数字证书认证机构(Certificate Authority, 缩写为 CA),是负责发放和管理数字证书的权威机构,它要制定政策和具体步骤来验证、识别用户身份,并对用户证书进行签名,以确保证书持有者的身份和公钥的拥有权。证书通常包括所有者的公钥、 证书的到期时间、所有者的名称和其他关于所有者的信息。

所以此问题可以通过下载证书的方式进行解决,具体操作方法如下:

  1. 下载证书保存到本地,下载地址:https://curl.haxx.se/ca/cacert.pem
  2. 配置 php.ini 文件:curl.cainfo =<filepath>/cacert.pem
  3. 重启 Apache 服务器,问题解决。

from acn-content.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.