0

PHP curl is not working for https requests on Amazon Linux. This is what I get when I curl an https url:

curl -v https://google.com
Rebuilt URL to: https://google.com/
Trying 172.217.3.174...
Connected to google.com (172.217.3.174) port 443 (#0)
Initializing NSS with certpath: sql:/etc/pki/nssdb
Closing connection 0
curl: (77) Problem with the SSL CA cert (path? access rights?)

I have tried different things but cannot figure out what the issue is. Any help will be much appreciated.

jww
  • 97,681
  • 90
  • 411
  • 885
umair
  • 957
  • 1
  • 9
  • 21
  • 1
    Check that you have the `php_openssl` extension enabled in php.ini – RiggsFolly Feb 15 '17 at 10:47
  • The curl binary and the php curl module are independend. This has nothing to do with PHP as you are calling curl from bash. – Daniel W. Feb 15 '17 at 13:03
  • Yes but the same certificate is used by both and the problem was with my certificate. – umair Feb 15 '17 at 13:07
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. Also see [Where do I post questions about Dev Ops?](http://meta.stackexchange.com/q/134306) – jww Feb 15 '17 at 13:20

1 Answers1

0

My certificate file was incorrect. It was being downloaded from http://curl.haxx.se/ca/cacert.pem. Had to change http to https.

umair
  • 957
  • 1
  • 9
  • 21