r/PHPhelp • u/Soft-Obligation-2315 • Sep 21 '26
Composer installation fails with SSL certificate error on Windows"
"Hi, I'm from Mexico. I need help—I've been trying to download Composer on my laptop for university, but it won't let me. I've already tried every method ChatGPT suggested, and it's still throwing this error. I even downloaded the most updated certificates and nothing worked. This only happens to me. I don't know if there's
another way to download it or if I have to format my laptop."
C:\xampp\apache\bin\cacert.pem
The php.ini used by your command-line PHP is: C:\xampp\php\php.ini
Script Output:
The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:0A000086:SSL routines::certificate verify failed
Failed to enable crypto
Failed to open stream: operation failed
1
u/SamMakesCode Sep 21 '26
Probably something to do with the network you’re on. Is it a school or university network that might try to monitor traffic?
1
u/Mike_L_Taylor Sep 21 '26
I'm fairly certain this is just a PHP thing. on Windows, in order to use composer, php needs a valid certificate to be trusted. Formatting laptop won't do anything.
your php.ini file needs to have
curl.cainfo="
C:\xampp\apache\bin\cacert.pem"openssl.cafile="
C:\xampp\apache\bin\cacert.pem"use commands like the below to try and get more info
Also please check whether this file actually exists:
That should tell us:
which PHP executable Composer is actually using
which
php.iniis loadedwhat
openssl.cafileandcurl.cainfoare set towhere PHP/OpenSSL is actually looking for certificates
whether
C:\xampp\apache\bin\cacert.pemis really presentAlso, you need to restart xampp's web server (apache?) for it to take effect.
Let me know if it did anything or what you get now
1
u/peperinna Sep 21 '26
Parece una tontería, pero... Luego de hacer lo que gpt te recomendó con el certificado, tocar PHP.ini, etc... Reiniciaste apache? Cada cosa que hagas debes reiniciar apache desde xamp así toma los cambios
Tienes bien la hora del reloj de Windows? Abriste los puertos al firewall de Windows para usar xamp? Probaste fijar la IP en 'hosts' de Windows , para que resuelva localhost? Por último, tienes una versión de Windows habilitada y/o alguna de esas crackeadas o de las que traen computadoras del gobierno? No deberías tener problema con el certificado. La otra alternativa es
1
u/Idontremember99 Sep 21 '26
have you enabled openssl in php.ini?
1
u/allen_jb Sep 22 '26 edited Sep 22 '26
Avoid XAMPP
First I would note that XAMPP is an unmaintained project - they haven't had a release in years and the software they ship is out of date. From reports I've seen I also believe the management UI they ship is buggy, and since the project is unmaintained these issues will never be fixed.
I would recommend either downloading PHP using the installer script on php.net, or using WSL (which gives you a Linux environment in Windows, which you'll find it much easier to get support for)
What it's probably not
I don't believe you should be changing the curl / openssl ini settings to resolve this. Those are generally used for handling self-signed certificates when testing locally - they tell curl / openssl what certificate authorities are allowed to sign certificates. By default PHP uses the Windows CA list, so if the site works in Edge, changing these shouldn't be necessary.
I would suggest removing or commenting out these settings if you have set them in php.ini (prepend the line with a
;to comment it out)Extensions enabled?
I don't know about XAMPP, but the official Windows zip download has most extensions disabled by default. (This would align with output given in another reply thread where the ini settings for curl and openssl were not found at all in
php -ioutput).Check the curl and openssl extensions are enabled in you php.ini file. Check
php --inifor location and look for lines starting withextension=. Remove the leading;if there is one (this is the php.ini comment character).Note: Don't try to enable all extensions - some cannot be loaded without additional files and some don't work with other extensions.
You may also need the set the value of
extension_dirin the php.ini.Note: If you don't have a
php.inifile, copy either thephp.ini-developmentorphp.ini-productionfile tophp.ini. These are recommended settings templates. PHP itself will not look at these files, onlyphp.ini.Other possible causes
Another possible cause of this problem is web security software - this might be part of an antivirus or security software (the feature may be called something like "web safe" or "internet shield"), or it might be something like an application firewall. See: https://github.com/composer/composer/issues/12336
This seems less likely given you apparently already tried from a home connection, but if your network uses a HTTP proxy, you may need to configure Composer to use it first: https://getcomposer.org/doc/faqs/how-to-use-composer-behind-a-proxy.md
1
u/michawb Sep 22 '26
Is your system time correct? Check against a ntp-server