{
    "href": "/post/2016/12/07/php-file-get-contents-httpsssl-error-on-mac-os/",
    "relId": "2016/12/07/php-file-get-contents-httpsssl-error-on-mac-os",
    "title": "PHP file_get_contents() HTTPS/SSL error on Mac OS",
    "author": "pmjones",
    "markup": "html",
    "tags": [
        {
            "href": "/tag/php/",
            "relId": "php",
            "title": "PHP",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        },
        {
            "href": "/tag/programming/",
            "relId": "programming",
            "title": "Programming",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        }
    ],
    "created": "2016-12-07 21:03:25 UTC",
    "updated": [
        "2016-12-07 21:03:25 UTC"
    ],
    "html": "<p>Problem on Mac OS Sierra (10.12.x): Using <code>file_get_contents()</code> for an https resource fails with <code>error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed</code>.</p>\n<p>This solution appears to be legit, although I am not primarily a security guy, so real security folks should chime in if they seem something untoward:</p>\n<blockquote>\n<pre><code>% sudo mkdir -p\u00c2\u00a0/usr/local/libressl/etc/ssl/certs\n% sudo\u00c2\u00a0curl -o /usr/local/libressl/etc/ssl/cert.pem https://curl.haxx.se/ca/cacert.pem</code></pre>\n<p>This creates the default_cert_file directories and imports the latest certificate store from curl.haxx.se.\n</p>\n</blockquote>\n<p>Source: <em><a href=\"https://andrewyager.com/2016/10/04/php-on-macos-sierra-cant-access-ssl-data/\">PHP on macOS Sierra can\u00e2\u0080\u0099t access SSL data \u00e2\u0080\u0093 andrewyager.com</a></em></p>\n"
}
