r/PHPhelp • u/Time-Reindeer8137 • May 24 '22
self-taught coder seeking help
Hey guys,
I'm creating an app that communicates with an API using the cURL library. I'm stuck trying to update my CA root certificates, I have the certificates downloaded but am not sure where and how to update it. I have looked through php.ini for 7.4.16 (my version), but there doesn't seem to be place to change the certs or even have certs set in the first place.
I found a risky work around by turning off CURLOPT_SSL_VERIFYPEER, I don't want to do that since it's a security risk.
Not sure what I'm doing wrong, have read through everything I could find online but still stuck.
Would appreciate any help! Thank you!
-1
u/horror-pangolin-123 May 24 '22
You can set that to false in your code during runtime, specificaly for that one domain that's causing issues. Take a look at https://www.php.net/manual/en/function.curl-setopt.php
5
u/MateusAzevedo May 24 '22
If the target domain has a valid cert and the problem is your own CA bundle, then you should fix the root cause.
Disabling SSL validation should be used just as a last resort for self-signed certs and I recommend only for internal servers.
2
u/Innominate8 May 24 '22
For internal servers is even worse. In the case of internal servers you can use a self-signed cert on one end, and then just make it a trusted CA on the other.
The only good reason to disable SSL validation is in debugging SSL issues.
2
3
u/MateusAzevedo May 24 '22
Recent post that may be helpful.