Questions : cURL error 60: SSL certificate in Laravel 5.4
2022-08-01T07:55:47+00:00 2022-08-01T07:55:47+00:00
3256
Full Error
RequestException in CurlFactory.php line anycodings_php 187: cURL error 60: SSL certificate problem: anycodings_php unable to get local issuer certificate (see anycodings_php //curl.haxx.se/libcurl/c/libcurl-errors.html)
Scenario
Before anyone points me to these two anycodings_php laracasts answers: anycodings_php //laracasts.com/discuss/channels/general-discussion/curl-error-60-ssl-certificate-problem-unable-to-get-local-issuer-certificate
//laracasts.com/discuss/channels/general-discussion/curl-error-60-ssl-certificate-problem-unable-to-get-local-issuer-certificate/replies/52954
I've already looked at them and that's why anycodings_php I'm here.
The problem I have is that now I have the anycodings_php cacert.pem file BUT it doesn't make sense anycodings_php where to put it, the answers indicate to anycodings_php place the file in my xampp directory and anycodings_php change my php.ini file but I'm not using anycodings_php xampp for anything, I'm using Laravel's anycodings_php artisan server to run my project.
If xampp is not in use, where should I place anycodings_php this file? Moreover, why would an accepted anycodings_php answer be to place it in my xampp directory? anycodings_php I dont understand.
My Exact Question
Where do I place the cacert.pem file to stop anycodings_php this error in laravel 5.4?
Total Answers 14
30
Answers 1 : of cURL error 60: SSL certificate in Laravel 5.4
Do not ever modify files in the vendor/ anycodings_php folder. Ever. They can and will be anycodings_php overwritten on the next composer update anycodings_php you run.
Here is my Solution for WampServer
I am using PHP 7.1.9 for my WampServer, anycodings_php so change 7.1.9 in the example below to anycodings_php the version number you are currently anycodings_php using.
- Download this file: //curl.haxx.se/ca/cacert.pem
- Place this file in the C:\wamp64\bin\php\php7.1.9 folder
- Open php.iniand find this line:
;curl.cainfo
Change it to:
curl.cainfo = anycodings_php "C:\wamp64\bin\php\php7.1.9\cacert.pem"
Make sure you remove the semicolon at anycodings_php the beginning of the line.
Save changes to php.ini, restart anycodings_php WampServer, and you're good to go!
0
2022-08-01T07:55:47+00:00 2022-08-01T07:55:47+00:00Answer Link
mRahman
2
Answers 2 : of cURL error 60: SSL certificate in Laravel 5.4
A quick solution but insecure (not anycodings_php recommended).
Using cURL:
Set CURLOPT_SSL_VERIYPEER to falseUsing Guzzle: Set verify to false, for anycodings_php example
$client->request('GET', '//somewebsite.com', ['verify' => false]);0
2022-08-01T07:55:47+00:00 2022-08-01T07:55:47+00:00Answer Link
raja
1
Answers 3 : of cURL error 60: SSL certificate in Laravel 5.4
- Solution suggested by some users to make changes to \vendor\guzzlehttp\guzzle\src\Client.php file is the worst advice, as manual changes made to vendor folder are overwritten if you run composer update command.
- Solution suggested by Jeffrey is a dirty, shorthand fix but not recommended in production applications.
- Solution suggested by kjdion84 is perfect if you have access to php.ini file on web server. In case you are using Shared Hosting, it may not be possible to edit php.ini file.
When you don't have access to php.ini anycodings_php file (e.g. Shared Hosting)
- Download this file: //curl.haxx.se/ca/cacert.pem or //curl.se/docs/caextract.html
- Place this file in the root folder of your Laravel project.
- Add verify key to GuzzleHttp\Client constructor with its value as path to cacert.pem file.
With Laravel 5.7 and GuzzleHttp 6.0
// //example.com/v1/current.json?key1=value1&key2=value2 $guzzleClient = new GuzzleHttp\Client([ 'base_uri' => '//example.com', 'verify' => base_path('cacert.pem'), ]); $response = $guzzleClient->get('v1/current.json', [ 'query' => [ 'key1' => 'value1', 'key2' => 'value2', ] ]); $response = json_decode($response->getBody()->getContents(), true);0
2022-08-01T07:55:47+00:00 2022-08-01T07:55:47+00:00Answer Link
joy
3
Answers 4 : of cURL error 60: SSL certificate in Laravel 5.4
You can use GuzzleHttp\Client:
$client = new Client(['verify' => anycodings_php false]);
0
2022-08-01T07:55:47+00:00 2022-08-01T07:55:47+00:00Answer Link
jidam
5
Answers 5 : of cURL error 60: SSL certificate in Laravel 5.4
This was stressfull to figure out but anycodings_php here is the exact answer for people anycodings_php using laravel and have this problem.
My exact application versions are...
Laravel: 5.4
Guzzle 6.2
Laravel Socialite: 3.0
Download a fresh copy of this curl anycodings_php certificate from this link: anycodings_php //gist.github.com/VersatilityWerks/5719158/download
Save the file in this path starting from anycodings_php the base root of your laravel anycodings_php application anycodings_php vendor/guzzlehttp/guzzle/src/cacert.pem
next in that same directory open up anycodings_php RequestOptions.php and scroll down to anycodings_php the constant called CERT and change it anycodings_php to this const CERT = 'cacert.pem'; and anycodings_php this should fix it all.
EDIT
As people are pointing out you should anycodings_php never edit the vendor folder, this was anycodings_php just a quick fix for an application I anycodings_php was building in my spare time. It wasn't anycodings_php anything majorly important like an anycodings_php application for my company or anything, anycodings_php use this method at your own risk! Please anycodings_php check out the other answers if you need anycodings_php something more concrete.
0
2022-08-01T07:55:47+00:00 2022-08-01T07:55:47+00:00Answer Link
miraj
5
Answers 6 : of cURL error 60: SSL certificate in Laravel 5.4
I was sending a request from domain X to anycodings_php Y, my problem was with the certificate anycodings_php used on the domain Y (it wasn't a anycodings_php self-signed cert btw), the domain anycodings_php belonged to me & I had the anycodings_php certificate, so the quick fix was to use anycodings_php the domain Y's certificate on domain X's anycodings_php application:
On domain X:
Using Laravel 7 HTTP wrapper:
\:withOptions(['verify' => anycodings_php 'path-to-domain-Y-certificate']);
Using guzzle:
new GuzzleHttp\Client(['verify' => anycodings_php 'path-to-domain-Y-certificate']);
OR you could just contact your SSL anycodings_php provider to resolve the issue.
Note: Storing your domain's certificate anycodings_php in another system isn't a secure method, anycodings_php use this method only if you can ensure anycodings_php your certificate's security.
I haven't found what was wrong with the anycodings_php certificate, no browser seemed to have a anycodings_php problem with it, the only problem was anycodings_php generated on laravel using curl.
0
2022-08-01T07:55:47+00:00 2022-08-01T07:55:47+00:00Answer Link
jidam
3
Answers 7 : of cURL error 60: SSL certificate in Laravel 5.4
I had this problem while running Valet anycodings_php and attempting to make an api from one anycodings_php site in valet to another. Note that i'm anycodings_php working in OSX. I found the solution anycodings_php here: anycodings_php //github.com/laravel/valet/issues/460 In anycodings_php short you have to copy the valet pem to anycodings_php the system CA bundle. Just run this:
cp /usr/local/etc/openssl/cert.pem /usr/local/etc/openssl/cert.pem.bak && cat ~/.config/valet/CA/LaravelValetCASelfSigned.pem >> /usr/local/etc/openssl/cert.pem0
2022-08-01T07:55:47+00:00 2022-08-01T07:55:47+00:00Answer Link
miraj
5
Answers 8 : of cURL error 60: SSL certificate in Laravel 5.4
We can set path based on this article on anycodings_php Medium.com How to fix cURL error 60: SSL anycodings_php certificate problem
Steps to follow:
- Open //curl.haxx.se/ca/cacert.pem
- Copy the entire page and save it as a “cacert.pemâ€Â
- Open your php.ini file and insert or update the following line. curl.cainfo = " [pathtofile]cacert.pem"
0
2022-08-01T07:55:47+00:00 2022-08-01T07:55:47+00:00Answer Link
raja
1
Answers 9 : of cURL error 60: SSL certificate in Laravel 5.4
Another one recently asked for the same anycodings_php problem and it's seems my answer was the anycodings_php solution for him. Here was the post I anycodings_php mention : URL Post
That's what I said :
I'll be fully honest, I don't know anycodings_php anything about Laravel. But I had the anycodings_php same problem, so as many other, on anycodings_php Symfony. And so as you I tried many anycodings_php things without success.
Finally, this solution worked for me : anycodings_php URL solution
It indicates that instead of a anycodings_php certificate problem, it could came anycodings_php from a environnement non-compatibility. anycodings_php I used XAMPP instead of WAMP and it anycodings_php worked.
0
2022-08-01T07:55:47+00:00 2022-08-01T07:55:47+00:00Answer Link
miraj
3
Answers 10 : of cURL error 60: SSL certificate in Laravel 5.4
Solved it on my end by disabling verify anycodings_php completely when on debug setting since anycodings_php in this local scenario security is not anycodings_php an issue at all.
$http = new \GuzzleHttp\Client([ 'base_uri' => config('services.passport.login_endpoint'), 'verify' => config('app.debug') ? false : true, 'defaults' => [ 'exceptions' => false, ] ]);0
2022-08-01T07:55:47+00:00 2022-08-01T07:55:47+00:00Answer Link
jidam
6
Answers 11 : of cURL error 60: SSL certificate in Laravel 5.4
You need to edit the following file in anycodings_php vendor/guzzlehttp/guzzle/src/Client.php
$defaults = [ 'allow_redirects' => RedirectMiddleware::$defaultSettings, 'http_errors' => true, 'decode_content' => true, 'verify' => false, // By default this value will be true 'cookies' => false ];May be security issue was there, but it anycodings_php will work.
0
2022-08-01T07:55:47+00:00 2022-08-01T07:55:47+00:00Answer Link
raja
4
Answers 12 : of cURL error 60: SSL certificate in Laravel 5.4
curl.cainfo = "C:\wamp64\bin\php\php7.1.9\cacert.pem"
I had resolved my problem with wamp.
0
2022-08-01T07:55:47+00:00 2022-08-01T07:55:47+00:00Answer Link
raja
1
Answers 13 : of cURL error 60: SSL certificate in Laravel 5.4
This happened to me in development with anycodings_php laravel 8 using the default server anycodings_php started by running:
php artisan serveThe solution for me was similar to other anycodings_php answers that require you to download anycodings_php cacert.pem and edit php.ini file. But anycodings_php since I was not using Wamp, I checked anycodings_php the path in my environment variables to anycodings_php find which php installation windows anycodings_php defaulted to and made the changes there.
0
2022-08-01T07:55:47+00:00 2022-08-01T07:55:47+00:00Answer Link
miraj
1
Answers 14 : of cURL error 60: SSL certificate in Laravel 5.4
for Laravel: The 5 steps below will be anycodings_php helpful
- update version to Guzzle 5.2
- find the file under \vendor\guzzlehttp\guzzle\src\Client.php
edit default settings to
protected function getDefaultOptions() anycodings_php { $settings = [ anycodings_php 'allow_redirects' => true, anycodings_php 'exceptions' => true, anycodings_php 'decode_content' => true, anycodings_php 'verify' => getcwd() anycodings_php .'/vendor/guzzlehttp/guzzle/src/cacert.pem' anycodings_php ]; }
download latest file cacert.pem from anycodings_php //curl.haxx.se/ca/cacert.pem and anycodings_php place under anycodings_php /vendor/guzzlehttp/guzzle/src/
0
2022-08-01T07:55:47+00:00 2022-08-01T07:55:47+00:00Answer Link
jidam