FSIBLOG

Composer Install Fails With “Certificate Verify Failed” on Windows: The Certificate File Isn’t the Problem, Whatever Is Reading Your Traffic Is

Composer SSL Certificate Verify Failed on Windows XAMPP Fix

What you already triedWhy it didn’t help
Every fix ChatGPT suggestedThey all point PHP at a certificate list. The installer already found yours at C:\xampp\apache\bin\cacert.pem.
Downloaded the newest certificatesA new list only helps when the site’s real certificate reaches PHP. Yours is being replaced on the way.
Thought about formatting the laptopNot needed. The laptop is fine. Something running on it, or the network it’s on, is the cause.
The error says "certificate verify failed," and the installer screen above it tells you why. It found cacert.pem, read php.ini, and still couldn't verify the connection. That happens when antivirus software or a school or office network sits between PHP and getcomposer.org and swaps in its own certificate. "This only happens to me" is the clue: the same laptop on a phone hotspot, or with the antivirus web shield paused, usually installs Composer in one go. Below, in order, are the two-minute check, the real fixes, and a manual install that works even if nothing else does.

What the Three Error Lines Are Saying

The installer printing C:\xampp\apache\bin\cacert.pem and C:\xampp\php\php.ini is it showing you what it used. Both were found. The certificate file is not missing and not the fault.

Find Out Who Is Signing Your Connections

Open Command Prompt and run this one line. It asks getcomposer.org for its certificate and prints who issued it.

C:\xampp\php\php.exe -r "$c=stream_context_create(['ssl'=>['capture_peer_cert'=>true,'verify_peer'=>false,'verify_peer_name'=>false]]); $f=fopen('https://getcomposer.org/versions','r',false,$c); $p=stream_context_get_params($f); print_r(openssl_x509_parse($p['options']['ssl']['peer_certificate'])['issuer']);"
What a clean connection shows
Array
(
[C] => US
[O] => Let's Encrypt
[CN] => R11
)

Fix the Interception: Pause the Shield or Trust Its Certificate

If It’s Your Antivirus

  1. Open the antivirus and find the setting called Web Protection, HTTPS scanning, Encrypted connections scanning or Web Shield. The name changes by product.
  2. Turn it off for 10 minutes.
  3. Run the Composer installer again.
  4. Turn the shield back on afterwards.

If you’d rather keep it on, add the antivirus’s root certificate to PHP’s list instead:

  1. Press Win + R, type certmgr.msc, press Enter.
  2. Open Trusted Root Certification Authorities → Certificates and find the one named after your antivirus.
  3. Right-click it → All Tasks → Export → choose Base-64 encoded X.509 (.CER) → save it as C:\xampp\antivirus-root.cer.
  4. Append it to the certificate file PHP uses:
type C:\xampp\antivirus-root.cer >> C:\xampp\apache\bin\cacert.pem

If It’s the University Network

Point PHP at a Fresh cacert.pem

Do this once anyway. XAMPP’s bundled certificate list can be years old, and an expired root in it causes the same error on a clean network.

  1. Download the current list from https://curl.se/ca/cacert.pem in your browser.
  2. Save it as C:\xampp\php\extras\ssl\cacert.pem. Make the folder if it isn’t there.
  3. Open C:\xampp\php\php.ini in Notepad and find these two lines. Remove the ; at the start if there is one, and set the path:
INI · C:\xampp\php\php.ini
curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"
openssl.cafile = "C:\xampp\php\extras\ssl\cacert.pem"
  1. Save the file. Close every Command Prompt window and open a new one, so PHP reads the change.
  2. Confirm PHP sees it:
C:\xampp\php\php.exe -r "print_r(openssl_get_cert_locations());"
The two lines that matter
[default_cert_file] => C:\xampp\php\extras\ssl\cacert.pem
[ini_cafile] => C:\xampp\php\extras\ssl\cacert.pem

Test the Download Before Running the Installer Again

C:\xampp\php\php.exe -r "echo substr(file_get_contents('https://getcomposer.org/versions'), 0, 60);"
What you should see
{"stable":[{"path":"/download/2.9

Install Composer by Hand When You Need It Working Today

This skips the installer’s download entirely. The browser already trusts your antivirus or campus certificate, so it can fetch the file PHP can’t.

  1. In your browser, download https://getcomposer.org/download/latest-stable/composer.phar.
  2. Make a folder C:\composer and move composer.phar into it.
  3. In the same folder, create a file called composer.bat with this one line:
Batch · C:\composer\composer.bat
@C:\xampp\php\php.exe "C:\composer\composer.phar" %*
  1. Add C:\composer to your PATH: press Win, type environment variables, open Edit the system environment variables → Environment Variables, pick Path under your user, click Edit → New, paste C:\composer, OK everything.
  2. Open a new Command Prompt and check:
composer --version
What you should see
Composer version 2.9.x 2026-xx-xx

The Fix You Will See Online That You Should Skip

Why It Looks Like It Only Happens to You

Exit mobile version