简体   繁体   English

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

[英]Local WordPress & MAMP wp_remote_get(): cURL error 60: SSL certificate problem: unable to get local issuer certificate

I have a site running locally on MAMP Pro (macos) and keep getting cURL errors when I use wp_remote_get()我有一个在 MAMP Pro (macos) 上本地运行的站点,并且在使用wp_remote_get()时不断收到 cURL 错误

I've searched and tried multiple solutions, but nothing seems to work.我已经搜索并尝试了多种解决方案,但似乎没有任何效果。

My code:我的代码:

$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"

I have:我有:

  1. Downloaded the latest CA file from https://curl.haxx.se/docs/caextract.htmlhttps://curl.haxx.se/docs/caextract.html下载最新的 CA 文件
  2. Replaced the cacert.pem file in my MAMP OpenSSL install: /Applications/MAMP/Library/OpenSSL/certs/cacert.pem替换了我的 MAMP OpenSSL 安装中的 cacert.pem 文件:/Applications/MAMP/Library/OpenSSL/certs/cacert.pem
  3. Opened the two relevant php.ini files.打开两个相关的php.ini文件。 One is located at /Applications/MAMP/conf/php7.4.2/php.ini and the other at /Applications/MAMP/bin/php/php7.4.2/conf/php.ini一个位于 /Applications/MAMP/conf/php7.4.2/php.ini,另一个位于 /Applications/MAMP/bin/php/php7.4.2/conf/php.ini
  4. Added the URL to the new 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"将 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"
  5. I also tried specifying curl.cainfo, openssl.cafile, openssl.capath via the MAMP GUI: File > Edit Template > PHP(php.ini) > 7.4.2我还尝试通过 MAMP GUI 指定 curl.cainfo、openssl.cafile、openssl.capath:文件 > 编辑模板 > PHP(php.ini) > 7.4.2

This is more of a local work around.这更像是一种本地解决方法。 You can disable SSL verification within your local site.您可以在本地站点中禁用 SSL 验证。 This can be accomplished by adding this line into the file wp-includes/functions.php or /wp-content/themes/YOUR_THEME/functions.php这可以通过将此行添加到文件wp-includes/functions.php/wp-content/themes/YOUR_THEME/functions.php

add_filter('https_ssl_verify', '__return_false');

暂无
暂无

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

相关问题 插件 WP CONTENT CRAWL - cURL 错误 60:SSL 证书问题:无法获得本地颁发者证书 - Plugin WP CONTENT CRAWL - cURL error 60: SSL certificate problem: unable to get local issuer certificate cURL 错误 60 - SSL 证书问题 - 无法获取本地颁发者 - cURL error 60 - SSL certificate problem - unable to get local issuer MAMP本地开发-cURL错误60:SSL证书:无法获得本地颁发者证书 - MAMP local development - cURL error 60: SSL certificate: unable to get local issuer certificate cURL 错误 60:SSL 证书:无法获取本地颁发者证书 - cURL error 60: SSL certificate: unable to get local issuer certificate WooCommce错误:cURL错误60:SSL证书问题:无法获取本地发行者证书。 - WooCommce Error: cURL error 60: SSL certificate problem: unable to get local issuer certificate. 我有这个错误“cURL 错误 60:SSL 证书问题:无法获得本地颁发者证书” - I have this error "cURL error 60: SSL certificate problem: unable to get local issuer certificate" 由于错误“cURL 错误 60:SSL 证书问题:无法获取本地颁发者证书”而无法获取文件 - Failed to fetch file due to error “cURL error 60: SSL certificate problem: unable to get local issuer certificate” Laravel Firebase cURL 错误 60:SSL 证书问题:无法获取本地颁发者证书 - Laravel Firebase cURL error 60: SSL certificate problem: unable to get local issuer certificate Laravel 8/Mailchimp: cURL 错误 60: SSL 证书问题:无法获取本地颁发者证书 - Laravel 8/Mailchimp: cURL error 60: SSL certificate problem: unable to get local issuer certificate Composer Curl 错误60:SSL 证书问题:无法获取本地颁发者证书 - Composer Curl error 60: SSL certificate problem: unable to get local issuer certificate
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM