Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 本地WordPress&;MAMP wp_remote_get():cURL错误60:SSL证书问题:无法获取本地颁发者证书_Php_Wordpress_Ssl_Curl_Mamp - Fatal编程技术网

Php 本地WordPress&;MAMP wp_remote_get():cURL错误60:SSL证书问题:无法获取本地颁发者证书

Php 本地WordPress&;MAMP wp_remote_get():cURL错误60:SSL证书问题:无法获取本地颁发者证书,php,wordpress,ssl,curl,mamp,Php,Wordpress,Ssl,Curl,Mamp,我有一个在MAMP Pro(macos)上本地运行的站点,当我使用wp\u remote\u get() 我搜索并尝试了多种解决方案,但似乎没有任何效果 我的代码: $url = site_url() . '/wp-json/wp/v2/my-cpt'; // This works just fine and shows up in the browser correctly $response = wp_remote_get( $url ); // this outputs the cURL

我有一个在MAMP Pro(macos)上本地运行的站点,当我使用
wp\u remote\u get()

我搜索并尝试了多种解决方案,但似乎没有任何效果

我的代码:

$url = site_url() . '/wp-json/wp/v2/my-cpt'; // This works just fine and shows up in the browser correctly
$response = wp_remote_get( $url ); // this outputs the cURL error: "cURL error 60: SSL certificate problem: unable to get local issuer certificate"
我有:

  • 已从下载最新的CA文件
  • 替换了我的MAMP OpenSSL安装中的cacert.pem文件:/Applications/MAMP/Library/OpenSSL/certs/cacert.pem
  • 打开了两个相关的php.ini文件。一个位于/Applications/MAMP/conf/php7.4.2/php.ini,另一个位于/Applications/MAMP/bin/php/php7.4.2/conf/php.ini
  • 将URL添加到新的cacert.pem curl.cainfo=“/Applications/MAMP/Library/OpenSSL/certs/cacert.pem”OpenSSL.cafile=“/Applications/MAMP/Library/OpenSSL/certs/cacert.pem”OpenSSL.capath=“/Applications/MAMP/Library/OpenSSL/certs”
  • 我还尝试指定curl.cainfo、openssl.cafile、openssl.capath 通过MAMP GUI:文件>编辑模板>PHP(PHP.ini)>7.4.2

  • 这更像是一项本地工作。您可以在本地站点中禁用SSL验证。这可以通过将此行添加到文件
    wp includes/functions.php
    /wp content/themes/YOUR_THEME/functions.php

    add_filter('https_ssl_verify', '__return_false');
    

    这更像是一项本地工作。您可以在本地站点中禁用SSL验证。这可以通过将此行添加到文件
    wp includes/functions.php
    /wp content/themes/YOUR_THEME/functions.php

    add_filter('https_ssl_verify', '__return_false');
    

    瑞安·多恩,你找到解决办法了吗?我也有同样的问题Ryan Dorn你找到解决办法了吗?我也有同样的问题。