Error Installing Composer on Windows 7 64-bit with

2019-06-07 00:38发布

问题:

I'm trying to install the Composer on W7 64x. Using the installer for Windows that the site Composer provides (Composer-setup.exe).

I have installed the Wampserver 2.5 with php5.5.12 and Apache2.4.9. The openssl is enabled in php.ini.

I'm having the following errors in the installation:

Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error
messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation
failed
Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error
messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation
failed
Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error
messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation
failed
The download failed repeatedly, aborting.

I installed xampp and WPN XM, but using the php.exe of both shows the following error:

Connection Error [ERR_CONNECTION]: Unable to connect to getcomposer.org
Request to https://getcomposer.org/installer failed with errors:
SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify
failed. Failed to enable crypto. Failed to open stream: operation failed

回答1:

Ensure that the SSL certs are installed and found by PHP.

In php.ini:

curl.cainfo=/path/to/ssl-certs/ca-bundle.crt
openssl.cafile=/path/to/ssl-certs/ca-bundle.crt

If certs are missing: download a cert bundle from http://curl.haxx.se/ca/cacert.pem and save as ca-bundle.crt.

(Or simply use a server stack for Windows, which ships Composer right out-of-the-box: WPN-XM)