Fixing file get contents ssl errors using laravel valet
Fixing annoying issues that I faced while using Laravel Valet.
August 05, 2022 • Code
cd ~/.config/valet/CA
curl --remote-name --time-cond cacert.pem https://curl.haxx.se/ca/cacert.pem
cat cacert.pem LaravelValetCASelfSigned.pem > cacert-mod.pem
echo $PWD/cacert-mod.pem
Copy the path from last line of code. It will look like this:
/Users/withoutwax/.config/valet/CA/cacert-mod.pem
Paste the line above into php.ini file. If unsure which PHP version, use <?php phpinfo(); ?> in the website page. Inside the php.ini file, paste the copied code next to openssl.cafile code. Once you paste the code, it will look like this:
openssl.cafile=/Users/username/.config/valet/CA/cacert-mod.pem
Now run valet restart and refresh the page.
Credit to: stackoverflow and this blog post by Leo Lutz.