I have new Laptop which has windows 11 installed. I have also install XAMPP which has php 8.2.12 version. Now i want to install composer in my system but it is not allowing me to install. It gives me error like
The Composer installer script was not successful [exit code 1].
OpenSSL failed with a 'certificate verify failed' error. This indicates a problem with
the Certificate Authority file(s) on your system, which may be out of date.
Certificate location [from openssl.cafile ini setting]:
C:\xampp\php\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
I have change certificate file as suggest from CHAT GPT. as given below
curl.cainfo = "C:\xampp\php\cacert.pem"
openssl.cafile = "C:\xampp\php\cacert.pem"
I have also set environment variable PATH to C:\XAMPP\PHP\PHP.exe and also check in CMD that it shows me PHP version 8.2.12 which is currently installed. I have also try to install composer manually using commands like
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
But it gives me error like below
Downloading...
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
Retrying...
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
Retrying...
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
The download failed repeatedly, aborting.
Can anyone suggest me what to do with this issue?
To download the latest composer, just visit https://getcomposer.org/download/2.8.6/composer.phar.
You can also visit https://getcomposer.org/versions first to choose another version.
For this "certificate verify failed" error, considering that you can download from https://getcomposer.org/installer
but not https://getcomposer.org/versions
, since both should return the same certificate, I guess it is likely that one local service (such as firewall) is preventing you from accessing the later URL.