首页 文章

Elasticsearch php api ssl无法获得本地颁发者证书

提问于
浏览
0

我一直在尝试使用Elasticsearch PHP API,在本地弹性搜索服务器上使用它完美地工作,我可以索引和搜索但是当我尝试在我的网络服务器上做同样的事情时,在documentation中使用like就是给我的以下错误:

Elasticsearch\Common\Exceptions\NoNodesAvailableException Object
(
    [message:protected] => No alive nodes found in your cluster
    [primary_port] => 9200
       (...)
        [local_ip] => 192.168.2.4
        [local_port] => 64641
        [error] => SSL certificate problem: unable to get local issuer certificate
        [errno] => 60

我在互联网上搜索并尝试:1 . 下载最新的cacert.pem 2.转到XAMPP php.ini并添加curl.cainfo =“C:/xampp/php/cacert.pem”行3.重新启动xampp和apache .

它什么也没做,所以我认为这可能是因为弹性搜索的PHP APi,但我不知道它是什么 .

随意请求任何东西 . 谢谢!

EDIT:

我在localhost上测试这个,但是当我通过https连接在线时,它给了我同样的错误 .

2 回答

  • -1

    If you use xampp, please read the following article which is pretty clear to understand why this happens and how to solve it

    再次打开php.ini文件并搜索[curl]区域,现在我们将取消注释并更改curl.cainfo和openssl.cafile属性的值 .

    [curl]
    ; A default value for the CURLOPT_CAINFO option. This is required to be an
    ; absolute path.
    curl.cainfo ="C:\xampp\perl\vendor\lib\Mozilla\CA\cacert.pem"
    
    [openssl]
    ; The location of a Certificate Authority (CA) file on the local filesystem
    ; to use when verifying the identity of SSL/TLS peers. Most users should
    ; not specify a value for this directive as PHP will attempt to use the
    ; OS-managed cert stores in its absence. If specified, this value may still
    ; be overridden on a per-stream basis via the "cafile" SSL stream context
    ; option.
    openssl.cafile="C:\xampp\perl\vendor\lib\Mozilla\CA\cacert.pem"
    

    您的证书路径可能会有所不同,因此我建议您阅读该文章 .

  • -1

    将此行添加到您的php.ini并重新启动xampp

    openssl.cafile="C:\xampp\php\cacert.pem"
    

相关问题