dongxietao0263 2018-02-23 14:56
浏览 191
已采纳

Windows MAMP - PHP CURL问题

I'm having issues with Windows MAMP Pro 3.3.1 getting PHP's CURL to work.

More specifically issue is that I can send requests to APIs using curl_exec, but it always returns false.

When I tried to do the same thing with XAMPP it returns full response with no issues.

I tried changing PHP version, I checked that php curl extensions is enabled and I can see CURL info in phpinfo.

Does any one know why and how to fix this issue with MAMP?

  • 写回答

1条回答 默认 最新

  • drq61040 2018-02-23 15:03
    关注

    So I've seen the issue. Apparently (still need to investigate), a CURL request does not get the certificate from the browser, unlike HTTPS. We'll need to manually download the certificate of the site and add it to the PHP ini.

    I got the certificate from here:

    https://curl.haxx.se/ca/cacert.pem

    Add the path to php.ini. You should see ;curl.cainfo under [curl]. Uncomment and add the path:

    curl.cainfo = "path_to_cert\cacert.pem"

    Restart apache and it'll work (at least mine did).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?