Skip to content
Advertisement

Windows MAMP – PHP CURL Issue

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?

Advertisement

Answer

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_certcacert.pem”

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

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement