9

Currently, I am doing a project on laravel5.

I use socialize for Facebook authentication,But I got cURL error Mentioned below.

 RequestException in CurlFactory.php line 162:
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

I have searched on internet and done following changes but didn't helped

  • downloaded cart.pem file
  • set path "curl.cainfo ="C:\xampp\cacert.pem"
  • also uncomment "extension=php_curl.dll"

My code of in controller

public function fb()  
{
    return Socialize::with('facebook')->redirect();
}
public function cb()    //callback for facebook
{
    $user = Socialize::with('facebook')->user();
    var_dump($user);
}
Nilesh
  • 804
  • 3
  • 10
  • 22
  • https://stackoverflow.com/questions/39686341/curl-error-60-ssl-certificate-unable-to-get-local-issuer-certificatetried-ever/44830568#44830568 – tolgatasci Jul 01 '17 at 13:14

7 Answers7

22

While on local-host with Laravel you can easily bypass cURL error.

navigate to Client.php file (vendor\guzzlehttp\guzzle\src\Client.php)

Change "verify" to false

$defaults = [
        'allow_redirects' => RedirectMiddleware::$defaultSettings,
        'http_errors'     => true,
        'decode_content'  => true,
        'verify'          => false,
        'cookies'         => false
    ];
Olufemi Ayodele
  • 371
  • 2
  • 7
19

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 just spent a number of hours grappling with this. The correct answer is

"indeed to put the cacert.pem file and amend the php.ini file to match as suggested by Moez above. ..... but I kept on getting CURL error 60's The trick was getting a clean copy of the PEM file! Any method involving windows notepad or other editors corrupts the file and gives the cURL error 60 etc. Finally I found https://gist.github.com/VersatilityWerks/5719158/download and downloaded a tar file with a clean copy of the cacert.pem file ...... it then all worked perfectly."

And since you are working on Windows, this could be the problem.

Community
  • 1
  • 1
Manan
  • 829
  • 9
  • 10
5

Windows : php.ini enter image description here

and worked fine

Hashmat Waziri
  • 843
  • 10
  • 10
  • cURL error 77: error setting certificate verify locations: CAfile: C:\xampp\php\cacert.pem CApath: none (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) – 151291 Aug 09 '17 at 09:36
2

For anyone pulling their hair out saying "I'VE DOWNLOADED A PRISTINE cacert.pem FILE, PUT IT IN THE CORRECT LOCATION, SET curl.cainfo CORRECTLY, AND RESTARTED MY APACHE SERVER BUT IT JUST DOESN'T WORK!?!?"... If you're using php-fpm then service apache2 restart and service apache2 reload will not update the reference and you'll continue to get error 60. If you intentionally point curl.cainfo to a bad path, you will not get the expected error 77 (first clue).

To restart php-fpm and update that reference (without rebooting the whole server), use service php-fpm restart or service php5-fpm restart or service php7-fpm restart or service php7.0-fpm restart, etc, depending on your php version. Hope this helps save someone time.

Matt Rabe
  • 1,437
  • 15
  • 25
1

After so much of research i found the best solution for this. You just need to make verification false in the vendor/guzzlehttp/guzzle/src/Client.php file .

    $defaults = [
        'allow_redirects' => RedirectMiddleware::$defaultSettings,
        'http_errors'     => true,
        'decode_content'  => true,
        'verify'          => true, // make this false
        'cookies'         => false,
        'idn_conversion'  => true,
    ];
  • 1
    DO NOT do this in production. Also editing files in vendor is a big mistake. If composer updates that lib any changes you make will be blown out and will then break your code. – Rick Kukiela Sep 24 '20 at 17:02
0

well it may sometimes be confusing. when you check the php.ini file you will see ;curl.cainfo = “certificate path\cacert.pem” you have to note there is a semicolon in front. remove that and all the quotes marks, and simple put the file path to look like this curl.cainfo = C:\xampp\php\extras\ssl\cacert.pem as you can see my cacert.pem is in the path C:\xampp\php\extras\ssl\cacert.pem thats where it should be . save and restart your server.

Fillz Adebayo
  • 302
  • 2
  • 6
0

You can disable SSL

composer config disable-tls true
composer config secure-http false
composer clearcache

After that execute = composer install

Abhishek Goel
  • 16,893
  • 10
  • 83
  • 64