John Davidson

php - Composer installation error on WAMP windows

0 comments
Message:


I am using the WAMP server on Windows system.
I tried to install composer following instructions from this site. so basically download and run Composer-Setup.exe. But during the installation, I received the following error:



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 either cannot be found or may be out of date.


Script Output: The "https://getcomposer.org/versions" file could not
be downloaded: SSL operation failed with code 1. OpenSSL Error
messages: error:1416F086:SSL
routines:tls_process_server_certificate:certificate verify failed
Failed to enable crypto failed to open stream: operation failed



I searched solutions online, it seems the cacert.pem file is missing. So I download the file from http://curl.haxx.se/ca/cacert.pem and placed it in the php folder:


C:\wamp64\bin\php\php7.3.21\cacert.pe

Then, I set the path of openssl.cafile and openssl.capath in php.ini


openssl.cafile="c:\wamp64\bin\php\php7.3.21\cacert.pem"
openssl.capath="c:\wamp64\bin\php\php7.3.21"

But still get the same error.
I checked php -r "var_dump(openssl_get_cert_locations());", the output is


Command line code:1:
array(8) {
'default_cert_file' =>
string(25) "C:\usr\local\ssl/cert.pem"
'default_cert_file_env' =>
string(13) "SSL_CERT_FILE"
'default_cert_dir' =>
string(22) "C:\usr\local\ssl/certs"
'default_cert_dir_env' =>
string(12) "SSL_CERT_DIR"
'default_private_dir' =>
string(24) "C:\usr\local\ssl/private"
'default_default_cert_area' =>
string(16) "C:\usr\local\ssl"
'ini_cafile' =>
string(0) ""
'ini_capath' =>
string(0) ""
}

So the default folder is "C:\usr\local\ssl/cert.pem", I don't know which folder is it in windows wamp and couldn't find a answer online.
what can I do more to make this work?



My Answer:
It seems like the issue is with the SSL certificate verification in OpenSSL. Here are a few more steps you can try to resolve the issue:

1. Make sure you have the latest version of OpenSSL installed on your system. You can download it from the official OpenSSL website.

2. Check the php.ini file for any other occurrences of openssl.cafile and openssl.capath settings. Make sure there are no conflicting settings that might be causing the issue.

3. Try setting the openssl.cafile and openssl.capath paths in the php.ini file to point directly to the cacert.pem file you downloaded. For example:
openssl.cafile="C:\wamp64\bin\php\php7.3.21\cacert.pem"
openssl.capath="C:\wamp64\bin\php\php7.3.21"

4. Restart the WAMP server after making these changes to the php.ini file to ensure they take effect.

5. If the issue persists, you can try disabling SSL verification temporarily by adding the following line to your composer.json file:
"config": {
"disable-tls": true
}

6. If none of the above solutions work, you can try using the Composer installer in manual mode. Download the Composer.phar file from the Composer website and place it in your project directory. Then run Composer commands using the Composer.phar file instead of the Composer executable.

Hopefully, one of these solutions will help you resolve the SSL certificate verification issue and successfully install Composer on your WAMP server.

Rate this post

3 of 5 based on 5111 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us