PHP - SSL certificate error: unable to get local issuer certificate
Finally got this to work!
Download the certificate bundle.
Put it somewhere. In my case, that was
c:\wamp\
directory (if you are using Wamp 64 bit then it'sc:\wamp64\
).Enable
mod_ssl
in Apache andphp_openssl.dll
inphp.ini
(uncomment them by removing;
at the beginning). But be careful, my problem was that I had twophp.ini
files and I need to do this in both of them. One is the one you get from your WAMP taskbar icon, and another one is, in my case, inC:\wamp\bin\php\php5.5.12\
Add these lines to your cert in both
php.ini
files:curl.cainfo="C:/wamp/cacert.pem"
openssl.cafile="C:/wamp/cacert.pem"Restart Wamp services.
PHP- curl unable to get local issuer certificate
The problem is resolved.
It wasn't a technical problem. The certificate that i received for the Service wasn't valid anymore and the new certificate isn't in the "cacert.pem" from Mozilla like the old one.
PHP cURL - SSL certificate problem: unable to get local issuer certificate
The problem was solved when the existing Intermediate-CA certificate file was replaced wth the latest version. The issue was the existing Intermediate-CA certificate file being an outdated version.
cURL error 60: SSL certificate: unable to get local issuer certificate
How to solve this problem:
download and extract cacert.pem following the instructions at https://curl.se/docs/caextract.html
save it on your filesystem somewhere (for example, XAMPP users might use
C:\xampp\php\extras\ssl\cacert.pem
)in your php.ini, put this file location in the
[curl]
section (putting it in the[openssl]
section is also a good idea):
[curl]
curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"
[openssl]
openssl.cafile = "C:\xampp\php\extras\ssl\cacert.pem"
- restart your webserver (e.g. Apache) and PHP FPM server if applicable
(Reference: https://laracasts.com/discuss/channels/general-discussion/curl-error-60-ssl-certificate-problem-unable-to-get-local-issuer-certificate)
Still same error display: cURL error 60: SSL certificate problem: unable to get local issuer certificate
How to solve this problem:
download and extract cacert.pem following the instructions at https://curl.se/docs/caextract.html
save it on your filesystem somewhere (for example, XAMPP users might use C:\xampp\php\extras\ssl\cacert.pem)
in your php.ini, put this file location in the [curl] section (putting it in the [openssl] section is also a good idea):
Example:
[curl]
curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"
[openssl]
openssl.cafile = "C:\xampp\php\extras\ssl\cacert.pem"
- restart your webserver (e.g. Apache) and PHP FPM server if applicable
reference here
You could also remove SSL validation on localhost. Just need to add options to de GuzzleHttp client in the 'withOptions' method to disable verification.
$options = ['verify'=>false];
To check if a local environment can do a simple if:
public function authApi(){
$options = [];
if (App::environment('local')) {
$options = ['verify'=>false];
}
return Http::withBasicAuth($this->client_key, $this->client_key_secret)->withOptions($options);
}
Ubuntu 22.04 LTS and Composer curl error 60 - SSL certificate problem: unable to get local issuer certificate
Finally managed to solve it by manually replacing the ca-bundle.crt file, after realizing that even a simple curl/wget CLI command (outside of PHP/Composer) returned the same error (this the reason of the --no-check-certificate below):
sudo mv /etc/ssl/certs/ca-bundle.crt /etc/ssl/certs/ca-bundle.crt.backup
sudo wget -O /etc/ssl/ca-bundle.crt https://curl.se/ca/cacert.pem --no-check-certificate
I got the link from: https://curl.se/docs/caextract.html
Related Topics
How to Get the Domain Name Without Www, Subdomain, and Com/Net/Org/Etc
Strip Null Values of Json Object
Laravel 5 - How to Access Image Uploaded in Storage Within View
Undefined Index: User_Id. Where, User_Id Is Session Variable
How to Store .Pdf Files into MySQL as Blobs Using PHP
Clear the Form Field After Successful Submission of PHP Form
Laravel 5.6 Class App\Http\Controllers\Postcontroller Does Not Exist
How to Capitalize First Letter in Laravel Blade
How to Count Occurrence of Duplicate Items in Array
How to Not Make Phpmailer Send an Email With Multiple 'To' Addresses
Block Direct Access to a File Over Http But Allow PHP Script Access
How to Update Stock Quantity Using MySQL in PHP
How to Use Bcrypt For Hashing Passwords in PHP