Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

Composer says the openssl extension is missing on Windows

ErrorComposer Warning: openssl extension is missing

Short answer

Composer needs PHP's OpenSSL extension for HTTPS. On Windows it is a line in php.ini that ships commented out. Remove the semicolon in the php.ini that the command line PHP loads, which is often not the one your web server uses, then open a new terminal. Do not set disable-tls.

  • Applies to Composer 2, PHP 8.3 on Windows, WampServer, XAMPP
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask the PHP that Composer uses which config file it loaded and whether OpenSSL is present.

    php --ini
    php -m | findstr /i openssl
  2. 2Match what you see, then jump to its fix

    1. 1php --ini names a php.ini, and php -m does not list openssl.The extension line is still commented outFix
    2. 2The line is enabled in one php.ini, yet php --ini shows another path.You edited a php.ini the command line does not loadFix

What does the error look like?

  • Composer Warning: openssl extension is missing
  • php -m does not list openssl

Cause 1 of 2

The extension line is still commented out

1Check

PHP ships its php.ini templates with the line for openssl commented out under Dynamic Extensions. A leading semicolon means it is off.

findstr /n /i "extension=openssl" "C:\path\to\php.ini"

2Fix

Open the php.ini shown by php --ini and remove the semicolon so the line reads extension=openssl. Check that extension_dir points at the ext folder of that PHP.

extension=openssl

3Verify

Open a new terminal (the old one keeps the old settings) and list modules again.

php -m | findstr /i openssl
composer diagnose

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 2

You edited a php.ini the command line does not load

1Check

PHP searches several places for its config, and it looks for php-SAPI.ini (for example php-cli.ini) before php.ini. The web server and the command line can load different files.

php --ini
where php

2Fix

Edit the file that php --ini reports for the CLI, or point the CLI at the file you want with the -c option. Make sure the PATH entry runs the PHP you meant.

php -c "C:\path\to\php.ini" -m | findstr /i openssl

3Verify

Run Composer again from a new terminal.

composer diagnose

Confirmed by php.net

Did this fix it?

How do I stop it coming back?

  • Run php --ini after each PHP upgrade, because the new install may bring a fresh php.ini.
  • Never set Composer's disable-tls: its docs call it a security risk and tell you to enable the extension instead.
  • Keep one PHP on PATH for the command line and know which one your web server uses.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

Apache returns 403 when a URL contains %3F

a request like /page%3Fname=test is refused while /page?name=test works

Recent Apache httpd blocks a rewrite when the request contains an encoded question mark (%3F) and the rewritten target has a literal ?.

2 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.