Curl Error : SSL certificate problem: unable to get local issuer certificate Laravel Wamp

Got this error when trying to use a Laravel API package that used Curl:

Curl Error : SSL certificate problem: unable to get local issuer certificate

I am using WAMP (local development) so the solution that worked was this (Let’s assume your PHP version is 7.1.9):

1. Download/save this file: http://curl.haxx.se/ca/cacert.pem into (your wamp path might differ) the C:\wamp64\bin\php\php7.1.9 folder.

2. Now you have to edit php.ini file but in my case it was not the one that is in the above folder (I tried that one first but still got the same error) but it was the one in this (your wamp and apache folder might differ) folder:  C:\wamp64\bin\apache\apache2.4.27\bin . The easiest way to open this file is to click on the green W (Wamp) icon in the tray, then PHP and then php.ini and Windows should open this file for you.

3. Find this line
;curl.cainfo
and change it to :
curl.cainfo = "C:\wamp614\bin\php\php7.1.9\cacert.pem"
Dont forget to remove the ; at the start of the line and of course use your wamp path.

4. Restart (or exit and start) the WAMP server and the error should be gone!

 

Laravel Composer using the wrong PHP version

I installed WAMP for offline development, then Composer and then Laravel. Everything was OK until I used Composer to download some Laravel package and I got this kind of error:

This package requires php >=7.0.0 but your PHP version (5.6.25) does not satisfy that requirement

Number don’t matter but I needed newer PHP. OK, I changed PHP version on WAMP, restarted it..and Laravel composer gave me the same error!

Long story short, after an hour of googling and trying all the suggested solutions like editing composer.json and this and that, nothing worked!

The solution is simple: reinstall Composer! D’oh!

When you run setup you can select the PHP version you want Composer to use (of course you have to have this PHP version installed on your PC or server) and the Composer will use it from then on:

 

laravel composer php version

After doing this this I was able to install the package. To be honest, I was quite upset that so many people offered some complicated solutions (that didn’t even work for me) on various forums and wasted my time when the solution was so simple.