Do not ever modify files in the vendor/
folder. Ever. They can and will be overwritten on the next composer update you run.
Here is my Solution for WampServer
I am using PHP 7.1.9 for my WampServer, so change 7.1.9
in the example below to the version number you are currently using.
- Download this file: http://curl.haxx.se/ca/cacert.pem
- Place this file in the
C:wamp64binphpphp7.1.9
folder - Open
php.ini
and find this line:
;curl.cainfo
Change it to:
curl.cainfo = "C:wamp64binphpphp7.1.9cacert.pem"
Make sure you remove the semicolon at the beginning of the line.
Save changes to php.ini
, restart WampServer, and you’re good to go!
answered Mar 2, 2018 at 14:48
12
A quick solution but insecure (not recommended).
Using cURL:
Set CURLOPT_SSL_VERIYPEER to false
Using Guzzle: Set verify to false, for example
$client->request('GET', 'https://somewebsite.com', ['verify' => false]);
Nimantha
6,6716 gold badges27 silver badges66 bronze badges
answered May 5, 2018 at 0:21
JeffreyJeffrey
1,9281 gold badge25 silver badges21 bronze badges
1
You can use GuzzleHttpClient
:
$client = new Client(['verify' => false]);
answered Jul 1, 2021 at 7:39
- Solution suggested by some users to make changes to
vendorguzzlehttpguzzlesrcClient.php
file is the worst advice, as manual changes made to vendor folder are overwritten if you runcomposer 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 editphp.ini
file.
When you don’t have access to php.ini
file (e.g. Shared Hosting)
- Download this file: http://curl.haxx.se/ca/cacert.pem or https://curl.se/docs/caextract.html
- Place this file in the root folder of your Laravel project.
- Add
verify
key toGuzzleHttpClient
constructor with its value as path tocacert.pem
file.
With Laravel 5.7 and GuzzleHttp 6.0
// https://example.com/v1/current.json?key1=value1&key2=value2
$guzzleClient = new GuzzleHttpClient([
'base_uri' => 'https://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);
answered Jan 19, 2019 at 18:16
Hamza RashidHamza Rashid
1,31716 silver badges21 bronze badges
1
This was stressfull to figure out but here is the exact answer for people using laravel and have this problem.
My exact application versions are…
Laravel: 5.4
Guzzlehttp: 6.2
Laravel Socialite: 3.0
Download a fresh copy of this curl certificate from this link: https://gist.github.com/VersatilityWerks/5719158/download
Save the file in this path starting from the base root of your laravel application vendor/guzzlehttp/guzzle/src/cacert.pem
next in that same directory open up RequestOptions.php
and scroll down to the constant called CERT
and change it to this const CERT = 'cacert.pem';
and this should fix it all.
EDIT
As people are pointing out you should never edit the vendor folder, this was just a quick fix for an application I was building in my spare time. It wasn’t anything majorly important like an application for my company or anything, use this method at your own risk! Please check out the other answers if you need something more concrete.
answered Feb 7, 2017 at 16:35
Yasmin FrenchYasmin French
1,1141 gold badge12 silver badges24 bronze badges
5
I was sending a request from domain X to Y, my problem was with the certificate used on the domain Y (it wasn’t a self-signed cert btw), the domain belonged to me & I had the certificate, so the quick fix was to use the domain Y’s certificate on domain X’s application:
On domain X:
-
Using Laravel 7 HTTP wrapper:
Http::withOptions(['verify' => 'path-to-domain-Y-certificate']);
-
Using guzzle:
new GuzzleHttpClient(['verify' => 'path-to-domain-Y-certificate']);
OR you could just contact your SSL provider to resolve the issue.
Note: Storing your domain’s certificate in another system isn’t a secure method, use this method only if you can ensure your certificate’s security.
I haven’t found what was wrong with the certificate, no browser seemed to have a problem with it, the only problem was generated on laravel using curl.
answered Jun 25, 2020 at 14:13
I had this problem while running Valet and attempting to make an api from one site in valet to another.
Note that i’m working in OSX.
I found the solution here: https://github.com/laravel/valet/issues/460
In short you have to copy the valet pem to 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.pem
answered Sep 21, 2019 at 9:27
omarjebariomarjebari
4,5172 gold badges34 silver badges30 bronze badges
I use laragon server and I faced to the same problem. I downloaded ssl certificate from http://curl.haxx.se/ca/cacert.pem and paste it in C:/laragon/etc/ssl/
(if cacert.pem already exists replace it with new one).
restart server and everything is fine
answered Aug 10, 2022 at 10:17
Another one recently asked for the same problem and it’s seems my answer was the solution for him.
Here was the post I mention : URL Post
That’s what I said :
I’ll be fully honest, I don’t know anything about Laravel. But I had
the same problem, so as many other, on Symfony. And so as you I tried
many things without success.Finally, this solution worked for me : URL solution
It indicates that instead of a certificate problem, it could came
from a environnement non-compatibility. I used XAMPP instead of
WAMP and it worked.
answered Feb 10, 2017 at 14:48
DoshibuDoshibu
1562 silver badges10 bronze badges
Solved it on my end by disabling verify
completely when on debug setting since in this local scenario security is not an issue at all.
$http = new GuzzleHttpClient([
'base_uri' => config('services.passport.login_endpoint'),
'verify' => config('app.debug') ? false : true,
'defaults' => [
'exceptions' => false,
]
]);
answered Mar 9, 2021 at 20:39
onewaveadrianonewaveadrian
4341 gold badge6 silver badges17 bronze badges
curl.cainfo = "C:wamp64binphpphp7.1.9cacert.pem"
I had resolved my problem with wamp.
Suraj Rao
29.3k11 gold badges96 silver badges103 bronze badges
answered Oct 8, 2021 at 6:14
1
This happened to me in development with laravel 8 using the default server started by running:
php artisan serve
The solution for me was similar to other answers that require you to download cacert.pem
and edit php.ini
file. But since I was not using Wamp, I checked the path
in my environment variables to find which php installation windows defaulted to and made the changes there.
answered Oct 14, 2021 at 3:58
crazy_abdulcrazy_abdul
4515 silver badges12 bronze badges
You need to edit the following file in 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 will work.
cokeman19
2,3971 gold badge25 silver badges40 bronze badges
answered May 16, 2021 at 18:34
for Laravel: The 5 steps below will be helpful
- update version to
Guzzlehttp: 5.2
- find the file under
vendorguzzlehttpguzzlesrcClient.php
-
edit default settings to
protected function getDefaultOptions() {
$settings = [
‘allow_redirects’ => true,
‘exceptions’ => true,
‘decode_content’ => true,
‘verify’ => getcwd() .’/vendor/guzzlehttp/guzzle/src/cacert.pem’
];
} -
download latest file cacert.pem from
http://curl.haxx.se/ca/cacert.pem
and place under/vendor/guzzlehttp/guzzle/src/
answered Jan 25, 2018 at 8:20
2
Hi, I am getting the SSL exception while uploading file to S3 , Strange thing is i have specified the certificate in the config/filesystems.php in s3 block but it still gives this error.
I tried uploading file to s3 using Curl command line it works fine with the cacerts which i am providing in the filesystem.
Any help will be greatly appreciated, I am not able to pin point the issue as curl command line able to upload file to s3.
Below is Stack Trace
GuzzleHttpExceptionRequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in /var/www/laravel/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:187
Stack trace:
#0 /var/www/laravel/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(150): GuzzleHttpHandlerCurlFactory::createRejection(Object(GuzzleHttpHandlerEasyHandle), Array)
#1 /var/www/laravel/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(103): GuzzleHttpHandlerCurlFactory::finishError(Object(GuzzleHttpHandlerCurlMultiHandler), Object(GuzzleHttpHandlerEasyHandle), Object(GuzzleHttpHandlerCurlFactory))
#2 /var/www/laravel/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(179): GuzzleHttpHandlerCurlFactory::finish(Object(GuzzleHttpHandlerCurlMultiHandler), Object(GuzzleHttpHandlerEasyHandle), Object(GuzzleHttpHandlerCurlFactory))
#3 /var/www/laravel/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(108): GuzzleHttpHandlerCurlMultiHandler->processMessages()
#4 /var/www/laravel/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(123): GuzzleHttpHandlerCurlMultiHandler->tick()
#5 /var/www/laravel/vendor/guzzlehttp/promises/src/Promise.php(246): GuzzleHttpHandlerCurlMultiHandler->execute(true)
#6 /var/www/laravel/vendor/guzzlehttp/promises/src/Promise.php(223): GuzzleHttpPromisePromise->invokeWaitFn()
#7 /var/www/laravel/vendor/guzzlehttp/promises/src/Promise.php(267): GuzzleHttpPromisePromise->waitIfPending()
#8 /var/www/laravel/vendor/guzzlehttp/promises/src/Promise.php(225): GuzzleHttpPromisePromise->invokeWaitList()
#9 /var/www/laravel/vendor/guzzlehttp/promises/src/Promise.php(267): GuzzleHttpPromisePromise->waitIfPending()
#10 /var/www/laravel/vendor/guzzlehttp/promises/src/Promise.php(225): GuzzleHttpPromisePromise->invokeWaitList()
#11 /var/www/laravel/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttpPromisePromise->waitIfPending()
#12 /var/www/laravel/vendor/aws/aws-sdk-php/src/S3/S3ClientTrait.php(33): GuzzleHttpPromisePromise->wait()
#13 /var/www/laravel/vendor/league/flysystem-aws-s3-v3/src/AwsS3Adapter.php(583): AwsS3S3Client->upload(‘elevatecds’, ‘4/mampleInitial…’, Resource id #8, ‘private’, Array)
#14 /var/www/laravel/vendor/league/flysystem-aws-s3-v3/src/AwsS3Adapter.php(368): LeagueFlysystemAwsS3v3AwsS3Adapter->upload(‘4/mampleInitial…’, Resource id #8, Object(LeagueFlysystemConfig))
#15 /var/www/laravel/vendor/league/flysystem/src/Filesystem.php(122): LeagueFlysystemAwsS3v3AwsS3Adapter->writeStream(‘4/mampleInitial…’, Resource id #8, Object(LeagueFlysystemConfig))
#16 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php(132): LeagueFlysystemFilesystem->putStream(‘4/mampleInitial…’, Resource id #8, Object(LeagueFlysystemConfig))
#17 /var/www/laravel/app/Http/Controllers/WorkspacesController.php(621): IlluminateFilesystemFilesystemAdapter->put(‘4/mampleInitial…’, Resource id #8, Array)
#18 [internal function]: AppHttpControllersWorkspacesController->uploadFile(Object(IlluminateHttpRequest))
#19 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(55): call_user_func_array(Array, Array)
#20 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(44): IlluminateRoutingController->callAction(‘uploadFile’, Array)
#21 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Route.php(203): IlluminateRoutingControllerDispatcher->dispatch(Object(IlluminateRoutingRoute), Object(AppHttpControllersWorkspacesController), ‘uploadFile’)
#22 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Route.php(160): IlluminateRoutingRoute->runController()
#23 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(572): IlluminateRoutingRoute->run()
#24 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): IlluminateRoutingRouter->IlluminateRouting{closure}(Object(IlluminateHttpRequest))
#25 /var/www/laravel/app/Http/Middleware/Authenticate.php(27): IlluminateRoutingPipeline->IlluminateRouting{closure}(Object(IlluminateHttpRequest))
#26 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): AppHttpMiddlewareAuthenticate->handle(Object(IlluminateHttpRequest), Object(Closure))
#27 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): IlluminatePipelinePipeline->IlluminatePipeline{closure}(Object(IlluminateHttpRequest))
#28 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(65): IlluminateRoutingPipeline->IlluminateRouting{closure}(Object(IlluminateHttpRequest))
#29 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): IlluminateFoundationHttpMiddlewareVerifyCsrfToken->handle(Object(IlluminateHttpRequest), Object(Closure))
#30 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): IlluminatePipelinePipeline->IlluminatePipeline{closure}(Object(IlluminateHttpRequest))
#31 /var/www/laravel/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): IlluminateRoutingPipeline->IlluminateRouting{closure}(Object(IlluminateHttpRequest))
#32 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): IlluminateViewMiddlewareShareErrorsFromSession->handle(Object(IlluminateHttpRequest), Object(Closure))
#33 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): IlluminatePipelinePipeline->IlluminatePipeline{closure}(Object(IlluminateHttpRequest))
#34 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): IlluminateRoutingPipeline->IlluminateRouting{closure}(Object(IlluminateHttpRequest))
#35 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): IlluminateSessionMiddlewareStartSession->handle(Object(IlluminateHttpRequest), Object(Closure))
#36 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): IlluminatePipelinePipeline->IlluminatePipeline{closure}(Object(IlluminateHttpRequest))
#37 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): IlluminateRoutingPipeline->IlluminateRouting{closure}(Object(IlluminateHttpRequest))
#38 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): IlluminateCookieMiddlewareAddQueuedCookiesToResponse->handle(Object(IlluminateHttpRequest), Object(Closure))
#39 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): IlluminatePipelinePipeline->IlluminatePipeline{closure}(Object(IlluminateHttpRequest))
#40 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): IlluminateRoutingPipeline->IlluminateRouting{closure}(Object(IlluminateHttpRequest))
#41 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): IlluminateCookieMiddlewareEncryptCookies->handle(Object(IlluminateHttpRequest), Object(Closure))
#42 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): IlluminatePipelinePipeline->IlluminatePipeline{closure}(Object(IlluminateHttpRequest))
#43 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): IlluminateRoutingPipeline->IlluminateRouting{closure}(Object(IlluminateHttpRequest))
#44 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(574): IlluminatePipelinePipeline->then(Object(Closure))
#45 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(533): IlluminateRoutingRouter->runRouteWithinStack(Object(IlluminateRoutingRoute), Object(IlluminateHttpRequest))
#46 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(511): IlluminateRoutingRouter->dispatchToRoute(Object(IlluminateHttpRequest))
#47 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): IlluminateRoutingRouter->dispatch(Object(IlluminateHttpRequest))
#48 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): IlluminateFoundationHttpKernel->IlluminateFoundationHttp{closure}(Object(IlluminateHttpRequest))
#49 /var/www/laravel/vendor/barryvdh/laravel-debugbar/src/Middleware/Debugbar.php(51): IlluminateRoutingPipeline->IlluminateRouting{closure}(Object(IlluminateHttpRequest))
#50 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): BarryvdhDebugbarMiddlewareDebugbar->handle(Object(IlluminateHttpRequest), Object(Closure))
#51 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): IlluminatePipelinePipeline->IlluminatePipeline{closure}(Object(IlluminateHttpRequest))
#52 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): IlluminateRoutingPipeline->IlluminateRouting{closure}(Object(IlluminateHttpRequest))
#53 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): IlluminateFoundationHttpMiddlewareCheckForMaintenanceMode->handle(Object(IlluminateHttpRequest), Object(Closure))
#54 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): IlluminatePipelinePipeline->IlluminatePipeline{closure}(Object(IlluminateHttpRequest))
#55 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): IlluminateRoutingPipeline->IlluminateRouting{closure}(Object(IlluminateHttpRequest))
#56 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): IlluminatePipelinePipeline->then(Object(Closure))
#57 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): IlluminateFoundationHttpKernel->sendRequestThroughRouter(Object(IlluminateHttpRequest))
#58 /var/www/laravel/public/index.php(53): IlluminateFoundationHttpKernel->handle(Object(IlluminateHttpRequest))
#59 {main}
“cURL error 60: SSL certificate problem: unable to get local issuer certificate” is a common error that occurs when your website tries to communicate with an external API via HTTPS and the SSL certificate on the server is not verified or properly configured. Although this error can be seen on any server you are more likely to see this issue on a localhost environment running on wampp/xampp.
Contact your web host to make sure that the SSL certificate is properly configured on the server. As of PHP 5.6 if the certificate is not verified you will also get a warning notice on your website.
How to fix cURL error 60: SSL certificate problem: unable to get local issuer certificate on localhost
1. Download the cacert.pem file from the official cURL website here.
2. Go the directory where you have installed xampp and put it in the ssl folder. For example,
C:xamppphpextrassslcacert.pem D:programxamppphpextrassslcacert.pem
3. Open your php.ini file and search for “curl.cainfo”.
4. Once you have found it, specify the path to the .pem file in the curl.cainfo section. For example,
curl.cainfo = "C:xamppphpextrassslcacert.pem"
The line could be commented out with a semicolon right before curl.cainfo. So make sure to uncomment it and replace ;curl.cainfo = with the line above.
5. Restart Apache so the new changes take effect on your localhost server.
That should fix the cURL error 60 issue on your web server. If you have any other suggestions for fixing this issue feel free to share it in the comments.
In this example we see how to fix cURL error 60 SSL certificate problem. cURL error 60: SSL certificate problem: unable to get local issuer certificate error occurs when we try to call the API with the secure https:// protocol in the request URL.
cURL error 60 SSL certificate problem on localhost in xampp and localhost wampp server. Also you can face curl 60 ssl certificate problem on windows, In laravel guzzle ssl certificate issue.
Why cURL Error 60 SSL certificate Occurs?
Your API call try to run request URL with only http:// protocol. You can’t see the error anymore because secure API calls require an SSL certificate or https:// protocol.
This error occurs because the API call makes a secure connection request using the self-signed certificate. When it does not find a valid certificate, it throws an error.
Read Also : Jquery Append And Prepend Example
How To Fix cURL Error 60 SSL Certificate Problem ?
1. Open http://curl.haxx.se/ca/cacert.pem or Download the “cacert.pem” free certificate file from the official website http://curl.haxx.se/docs/caextract.html
2. Save it as a “cacert.pem”.
3. Paste cacert.pem in WAMP user to C:wamp64binphpcacert.pem
, for XAMPP user to C:xamppphpextrassslcacert.pem path.
4. Open php.ini
and find this line
;curl.cainfo
5. Now, we need to add the path of the certificate to “curl.cainfo” and remove semicolon(;) as follow.
curl.cainfo = "C:wamp64binphpcacert.pem"
6. The most important step is to save and close your php.ini. Restart your WAMP or XAMPP server and try your request again. If you do not set the right path, then you will experience a cURL 77 error.
You might also like :
- Read Also : How To Solve The Page Expired 419 Error In Laravel
- Read Also : Laravel 8 cURL HTTP Request Example
- Read Also : CRUD Operation In PHP
Full Error
RequestException in CurlFactory.php line 187: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
Scenario
Before anyone points me to these two laracasts answers: https://laracasts.com/discuss/channels/general-discussion/curl-error-60-ssl-certificate-problem-unable-to-get-local-issuer-certificate
https://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 thats why im here,
The problem i have is that i now have the cacert.pem file BUT it doesn’t make sense where to put it, the answers indicate to place the file in my xampp directory and change my php.ini
file but im not using xampp for anything, im using laravel’s artisan server to run my project. If xampp is not in use then where do i place this file & more so why would an accepted answer be to place it in my xampp directory i dont understand
My Exact Question
Where do i place the cacert.pem
file to stop this error in laravel 5.4?
SOLUTION 1 :
Do not ever modify files in the vendor/
folder. Ever. They can and will be overwritten on the next composer update you run.
Here is my Solution for WampServer
I am using PHP 7.1.9 for my WampServer, so change 7.1.9
in the example below to the version number you are currently using.
- Download this file: http://curl.haxx.se/ca/cacert.pem
- Place this file in the
C:wamp64binphpphp7.1.9
folder - Open
php.ini
and find this line:
;curl.cainfo
Change it to:
curl.cainfo = "C:wamp64binphpphp7.1.9cacert.pem"
Make sure you remove the semicolon at the beginning of the line.
Save changes to php.ini
, restart WampServer, and you’re good to go!
SOLUTION 2 :
This was stressfull to figure out but here is the exact answer for people using laravel and have this problem.
My exact application versions are…
Laravel: 5.4
Guzzlehttp: 6.2
Laravel Socialite: 3.0
Download a fresh copy of this curl certificate from this link: https://gist.github.com/VersatilityWerks/5719158/download
Save the file in this path starting from the base root of your laravel application vendor/guzzlehttp/guzzle/src/cacert.pem
next in that same directory open up RequestOptions.php
and scroll down to the constant called CERT
and change it to this const CERT = 'cacert.pem';
and this should fix it all.
EDIT
As people are pointing out you should never edit the vendor folder, this was just a quick fix for an application I was building in my spare time. It wasn’t anything majorly important like an application for my company or anything, use this method at your own risk! Please check out answers below
SOLUTION 3 :
A quick solution but insecure (not recommended).
Using cURL:
Set CURLOPT_SSL_VERIYPEER to false
Using Guzzle:
Set verify to false
example $client->request(‘GET’, ‘https://somewebsite.com’, [‘verify’ => false]);
SOLUTION 4 :
Another one recently asked for the same problem and it’s seems my answer was the solution for him.Here was the post I mention : URL Post
That’s what I said :
I’ll be fully honest, I don’t know anything about Laravel. But I had the same problem, so as many other, on Symfony. And so as you I tried many things without success.
Finally, this solution worked for me : URL solution
It indicates that instead of a certificate problem, it could came from a environnement non-compatibility. I used XAMPP instead of WAMP and it worked.
SOLUTION 5 :
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
file (e.g. Shared Hosting)
- Download this file: http://curl.haxx.se/ca/cacert.pem
- Place this file in the root folder of your project
- Add
verify
key toGuzzleHttpClient
constructor with its value as path tocacert.pem
file.
With Laravel 5.7 and GuzzleHttp 6.0
// https://example.com/v1/current.json?key1=value1&key2=value2$guzzleClient = new GuzzleHttpClient([
'base_uri' => 'https://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);
SOLUTION 6 :
for Laravel: The 5 steps below will be helpful
- update version to
Guzzlehttp: 5.2
- find the file under
vendorguzzlehttpguzzlesrcClient.php
-
edit default settings to
protected function getDefaultOptions() { $settings = [ ‘allow_redirects’ => true, ‘exceptions’ => true, ‘decode_content’ => true, ‘verify’ => getcwd() .’/vendor/guzzlehttp/guzzle/src/cacert.pem’ ];}
-
download latest file cacert.pem from
http://curl.haxx.se/ca/cacert.pem
and place under/vendor/guzzlehttp/guzzle/src/
Label : tag_php tag_curl tag_laravel-53
При отправке запроса средствами cURL можно получить ошибку: SSL certificate problem: unable to get local issuer certificate
.
Можно просто отключить проверку SSL-сертификата. Например, вот так:
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://site.com'); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $result = curl_exec($ch);
Более правильным решением будет добавление сертификата в доверенные. Скачать свежую версию сертификата по адресу https://curl.haxx.se/ca/cacert.pem. Поместить данный файл на сервер. У меня это директория S:Serverbinphpextrasssl
.
Далее в настройках файла php.ini
указать путь к данному файлу:
[curl] curl.cainfo = S:Serverbinphpextrassslcacert.pem
Перезапустить apache.
// Находясь в директории bin ( путь/к/файлу/httpd ) httpd -k start httpd -k restart httpd -k stop (httpd - k shutdown) // Работа с apache как со службой Windows net stop apache2.4 net start apache2.4 // Мой httpd.exe S:ServerbinApache24binhttpd -k restart
Luigui Moreno
Posted on Dec 29, 2021
• Updated on Jan 8, 2022
#laravel
To fix the above exception you should add the valet certificate to the end of the openssl cert.pem file:
cat ~/.config/valet/CA/LaravelValetCASelfSigned.pem >> /usr/local/etc/ca-certificates/cert.pem
You can find the cert.pem location running this dd(openssl_get_cert_locations());
anywhere in the Laravel app.
Top comments (2)
Subscribe
Create template
Templates let you quickly answer FAQs or store snippets for re-use.
Dismiss
Collapse
Expand
Luigui Moreno
Luigui Moreno
Slow but constant developer
-
Location
Bogota
-
Work
Founder at Colgafas
-
Joined
Jun 13, 2019
•
Dec 29 ’21
- Copy link
In «pusher/pusher-php-server»: «~5.0» and above version curl_options is ignored, Guzzle Client is used instead of curl.
Collapse
Expand
Raja
Raja
-
Joined
Apr 19, 2020
•
Dec 3 ’22
- Copy link
Genius!! Thank you 🙏
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment’s permalink.
Hide child comments as well
For further actions, you may consider blocking this person and/or reporting abuse
You can see total article reactions, views, and listing information by heading over to your dashboard.
Read next
How To Use Toastr Notification In Laravel 9
Techsolutionstuff — Nov 11 ’22
Integrate third-party services within Laravel
Anwar — Nov 9 ’22
Laravel 9 Send Mail Using Queue Example
Techsolutionstuff — Nov 10 ’22
Getting Started with Laravel and Vue Js – Benefits for Programmers
Abdullah Mangi — Nov 8 ’22