Skip to content
Advertisement

openssl.cafile with no value for web requests only

In a fresh Valet installation I’ve updated within my php.ini:

openssl.cafile = "/usr/local/etc/openssl@1.1/cert.pem"

Then, within my Laravel public/index.php I’m outputting my phpinfo(); on line 1.

If I then perform a request via Postman I can see:

<tr class="h">
    <th>Directive</th>
    <th>Local Value</th>
    <th>Master Value</th>
</tr>
<tr>
    <td class="e">openssl.cafile</td>
    <td class="v"><i>no value</i></td>
    <td class="v"><i>no value</i></td>
</tr>

However the expected result I can see via tinker is:

Directive => Local Value => Master Value
openssl.cafile => /usr/local/etc/openssl@1.1/cert.pem => /usr/local/etc/openssl@1.1/cert.pem

As far as I understand both requests should load the same file, yet that doesn’t happen.

In both cases loaded php.ini is the same:

<tr>
    <td class="e">Loaded Configuration File </td>
    <td class="v">/usr/local/etc/php/7.4/php.ini </td>
</tr>
Loaded Configuration File => /usr/local/etc/php/7.4/php.ini

I’ve already tried copying the pem to a different folder, but either way it’s not loaded for web requests. What can I do?

Advertisement

Answer

Still don’t know what the reason for this is, but as a workaround I’ve:

  • copied /usr/local/etc/openssl@1.1/cert.pem to /usr/local/etc/php/7.4/cacert.pem
  • set curl.cainfo = "/usr/local/etc/php/7.4/cacert.pem" within my php.ini file

This way at least given file is always included

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement