Fixing file_get_contents SSL errors & using Laravel Valet

Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:1 ...

Code |

February 21, 2020

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.

Copyright © 2020 Will Kim

Invely's