{"record":{"id":"bc6984b1bfe8f9a0","repo":"DenverCoder1/github-readme-streak-stats","slug":"500-you-don-t-have-a-valid-ssl-certificate-installed-or","errorCode":"500","errorMessage":"You don't have a valid SSL Certificate installed or XAMPP.","messagePattern":"You don't have a valid SSL Certificate installed or XAMPP\\.","errorType":"exception","errorClass":"AssertionError","httpStatus":500,"severity":"error","filePath":"src/stats.php","lineNumber":74,"sourceCode":"        curl_multi_add_handle($multi, $handle);\n    }\n    // execute queries\n    $running = null;\n    do {\n        curl_multi_exec($multi, $running);\n    } while ($running);\n    // collect responses\n    $responses = [];\n    foreach ($requests as $year => $handle) {\n        $contents = curl_multi_getcontent($handle);\n        $decoded = is_string($contents) ? json_decode($contents) : null;\n        // if response is empty or invalid, retry request one time or throw an error\n        if (empty($decoded) || empty($decoded->data) || !empty($decoded->errors)) {\n            $message = $decoded->errors[0]->message ?? ($decoded->message ?? \"An API error occurred.\");\n            $error_type = $decoded->errors[0]->type ?? \"\";\n            // Missing SSL certificate\n            if (curl_errno($handle) === 60) {\n                throw new AssertionError(\"You don't have a valid SSL Certificate installed or XAMPP.\", 500);\n            }\n            // Other cURL error\n            elseif (curl_errno($handle)) {\n                throw new AssertionError(\"cURL error: \" . curl_error($handle), 500);\n            }\n            // GitHub API error - Not Found\n            elseif ($error_type === \"NOT_FOUND\") {\n                throw new InvalidArgumentException(\"Could not find a user with that name.\", 404);\n            }\n            // if rate limit is exceeded, don't retry with same token\n            if (str_contains($message, \"rate limit exceeded\")) {\n                removeGitHubToken($tokens[$year]);\n            }\n            error_log(\"First attempt to decode response for $user's $year contributions failed. $message\");\n            error_log(\"Contents: $contents\");\n            // retry request\n            $query = buildContributionGraphQuery($user, $year);\n            $token = getGitHubToken();","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/DenverCoder1/github-readme-streak-stats/blob/70dd50f921097927dc8314ac33a04b010a09924d/src/stats.php#L56-L92","documentation":"executeContributionGraphRequests() performs cURL requests to the GitHub GraphQL API. cURL error 60 (SSL certificate problem) is caught specifically and rethrown as AssertionError telling the developer their environment lacks a valid SSL CA certificate setup, commonly an XAMPP/local-dev issue.","triggerScenarios":"A cURL request to the GitHub API fails with error code 60 (CURLE_PEER_FAILED_VERIFICATION): missing or outdated CA bundle, self-signed proxies, or XAMPP's default certificate configuration.","commonSituations":"Local development with XAMPP where php.ini has no curl.cainfo set; corporate proxy with TLS interception; outdated CA certificate bundle on the server.","solutions":["Download cacert.pem and set curl.cainfo and openssl.cafile in php.ini to its path","Update the operating system's CA certificate bundle (e.g. apt-get install --reinstall ca-certificates)","Restart the web server/PHP-FPM after changing php.ini","Check for TLS-intercepting proxies and add their root CA to the bundle"],"exampleFix":"// before (php.ini)\n;curl.cainfo =\n// after\ncurl.cainfo = \"C:\\xampp\\php\\extras\\ssl\\cacert.pem\"\nopenssl.cafile = \"C:\\xampp\\php\\extras\\ssl\\cacert.pem\"","handlingStrategy":"try-catch","validationCode":"// pre-check: can PHP reach GitHub over TLS?\n$r = curl_init(\"https://api.github.com\"); curl_setopt($r, CURLOPT_NOBODY, true); curl_setopt($r, CURLOPT_RETURNTRANSFER, true); curl_exec($r); if (curl_errno($r) === 60) { die(\"Fix CA bundle in php.ini\"); }","typeGuard":null,"tryCatchPattern":"try { $graphs = getContributionGraphs($user); } catch (AssertionError $e) { if (str_contains($e->getMessage(), \"SSL Certificate\")) { log_ssl_config_error(); } throw $e; }","preventionTips":["Set curl.cainfo/openssl.cafile in php.ini on every environment","Keep OS CA certificates updated","Test TLS connectivity in CI/health checks"],"tags":["php","ssl","curl","tls","environment"],"backgroundTag":"ssl-certificate-verification-failed","analyzedSha":"70dd50f921097927dc8314ac33a04b010a09924d","analyzedAt":"2026-09-15T02:40:51.909Z","contentChangedAt":"2026-09-15T02:40:51.909Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}