“SSL certificate problem: unable to get local issuer certificate” means the TLS verifier could not build an acceptable chain to a trusted issuer. The missing piece may be a server intermediate certificate, a private organization's CA, or the CA store selected by the client. It does not automatically mean the website's certificate is expired.
Identify the failing program first. curl, Git and PHP can use different libcurl builds, TLS backends or CA locations even on the same machine. A successful browser connection does not prove that a command-line client has the same trust store.
In this guide
Find the runtime and the missing link
Program | Inspect | Scoped CA configuration |
|---|---|---|
curl |
|
|
Git over HTTPS |
|
|
PHP cURL | The PHP runtime, cURL extension and loaded configuration |
|
The server normally presents its leaf certificate and required intermediates. The client must trust an appropriate root and verify the target hostname. A missing intermediate is usually repaired on the server. An approved private root belongs in the intended client's trust configuration. Those are different repairs.
The curl certificate guide explains native stores and file-based trust. Backend behavior varies, so inspect the actual build instead of assuming every platform reads the same bundle.
Reproduce a missing issuer without changing system trust
The archive creates a fictional local CA and a localhost server certificate. It binds the services to loopback, does not install the CA into your OS and does not contact a customer endpoint. From the extracted directory:
python3 prepare_demo.py
python3 demo_server.pyLeave the server running. In another terminal in that directory:
curl --noproxy '*' --max-time 5 \
https://localhost:8813/demo/okWithout trusting the example CA, curl 8.7.1 exits with code 60. PHP's cURL extension reports error 60 with an issuer verification error for the same destination. Exact messages vary with the TLS backend.
Now provide the CA created by the local fixture:
curl --noproxy '*' --fail-with-body --silent --show-error \
--cacert fixtures/certs/ca.pem \
https://localhost:8813/demo/okThe request returns:
{"ok":true,"name":"Desk Lamp"}Both issuer trust and hostname verification remain enabled. For a real service, obtain the CA from the service operator, your organization's approved distribution or the relevant public CA source. Do not trust an arbitrary certificate file merely because it makes an error disappear.
Apply a scoped fix to Git
The local server also exposes a small fictional Git repository. Compare these two commands:
git -c http.proxy= \
ls-remote https://localhost:8813/demo.git
git -c http.proxy= \
-c http.sslCAInfo=fixtures/certs/ca.pem \
ls-remote https://localhost:8813/demo.gitWithout the local CA, the first command fails certificate verification. The second lists HEAD and refs/heads/main. -c scopes the setting to that invocation; it does not change a global Git configuration.
For an existing repository, inspect applicable settings and their origin:
git config --show-origin --get-regexp '^http\..*(sslCAInfo|sslBackend|schannelUseSSLCAInfo)$'No matching setting is not itself an error. Git builds using Windows Schannel can prefer the native Windows certificate store; http.schannelUseSSLCAInfo affects whether a specified CA bundle is used with that backend. Follow the Git HTTP configuration reference for the actual platform. Do not assume a PEM option overrides every native store automatically.
Point PHP cURL at the intended CA
The CLI and web server can load different PHP configuration files. Inspect the failing runtime, rather than only the php binary in your terminal:
php --ini
php -r 'echo ini_get("curl.cainfo"), PHP_EOL; print_r(curl_version());'For the local example, run php php_tls.php:
<?php
$handle = curl_init('https://localhost:8813/demo/ok');
curl_setopt_array($handle, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CAINFO => __DIR__ . '/fixtures/certs/ca.pem',
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_CONNECTTIMEOUT => 3,
CURLOPT_TIMEOUT => 5,
CURLOPT_PROXY => '',
]);
$body = curl_exec($handle);
if ($body === false) {
throw new RuntimeException('cURL ' . curl_errno($handle) . ': ' . curl_error($handle));
}
$status = curl_getinfo($handle, CURLINFO_RESPONSE_CODE);
if ($status !== 200) {
throw new RuntimeException('HTTP ' . $status);
}
$data = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
echo json_encode(['status' => $status, 'data' => $data], JSON_PRETTY_PRINT) . PHP_EOL;It returns HTTP 200 and the fictional JSON record. CURLOPT_CAINFO is scoped to that handle. A runtime-wide curl.cainfo setting requires an absolute file path; restart the appropriate PHP service if its configuration changes. openssl.cafile governs PHP's OpenSSL stream behavior and should not be assumed to repair the cURL extension's CA selection. See the PHP cURL configuration reference.

Inspect the server and proxy chain when a CA path is not enough
For a public HTTPS service, inspect the presented certificates with:
openssl s_client -connect example.com:443 \
-servername example.com -showcerts </dev/nullUse the real hostname. Look at the issuer chain and the final verification result, not just the fact that a TLS session opened. If the server omits an intermediate, ask its operator to serve the complete chain. Do not copy the leaf certificate into a CA bundle as a substitute for fixing the chain.
A network that performs approved TLS inspection can present an organizational issuer. Confirm that issuer with the network operator. With an HTTPS proxy, the proxy's TLS certificate and the destination's TLS certificate have separate trust settings; an HTTP CONNECT tunnel alone does not prove either certificate is trusted.
Frequently asked questions
Will changing the proxy IP repair issuer trust?
It can change the network path, but it does not update the client's CA store or repair a server's certificate chain. Identify which TLS connection failed first.
Should I turn certificate verification off?
Keep verification enabled. A request that ignores certificate errors does not demonstrate that the intended peer was authenticated, and it leaves the underlying issuer problem unresolved.
What should I check after the repair?
Repeat the same request in the same runtime and route. Confirm successful certificate verification, the expected HTTP status and the expected body. A fix in CLI PHP alone does not establish that the web server's PHP runtime is fixed.