0

While running composer install, I keep getting following error all of a sudden

[Composer\Downloader\TransportException]
 The "https://packagist.org/packages.json" file could not be downloaded: SSL
  operation failed with code 1. OpenSSL Error messages:
 error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
failed to open stream: Cannot connect to HTTPS server through proxy

Does anyone had this issue before?

Following are my composer settings -

[cache-ttl] 15552000
[cache-files-ttl] 15552000
[cache-files-maxsize] 300MiB (314572800)
[bin-compat] auto
[discard-changes] false
[autoloader-suffix]
[sort-packages] false
[optimize-autoloader] false
[classmap-authoritative] false
[apcu-autoloader] false
[prepend-autoloader] true
[github-domains] [github.com]
[bitbucket-expose-hostname] true
[disable-tls] true
[secure-http] false
[cafile]
[capath]
[github-expose-hostname] true
[gitlab-domains] [gitlab.com]
[store-auths] prompt
[archive-format] tar
[archive-dir] .
[htaccess-protect] 1
Praveen Govind
  • 2,619
  • 2
  • 32
  • 45

2 Answers2

2

The problem resolved for me by making this:

HTTP_PROXY_REQUEST_FULLURI=false

It is a Composer environment parameter, there is one for the HTTP and the HTTPS proxy:

HTTP_PROXY_REQUEST_FULLURI

If you use a proxy, but it does not support the request_fulluri flag, then you should set this env var to false or 0 to prevent Composer from setting the request_fulluri option.

HTTPS_PROXY_REQUEST_FULLURI

If you use a proxy, but it does not support the request_fulluri flag for HTTPS requests, then you should set this env var to false or 0 to prevent Composer from setting the request_fulluri option. (source)

Both relating to the request_fulluri flag:

request_fulluri bool

When set to true, the entire URI will be used when constructing the request. (e.g. GET http://www.example.com/path/to/file.html HTTP/1.0). While this is a non-standard request format, some proxy servers require it. (source)

hakre
  • 193,403
  • 52
  • 435
  • 836
bouguima
  • 158
  • 15
-1

Composer uses wget to request the network.

:SSL routines:ssl3_get_server_certificate:certificate verify failed
failed to open stream: Cannot connect to HTTPS server through a proxy

I think you can add check_certificate = off in your ~/.wgetrc not to check certificates. If you prefer you can configure certificate verification in /etc/wgetrc too.

Dharman
  • 30,962
  • 25
  • 85
  • 135
allema_s
  • 132
  • 1
  • 6
  • Can you share more details about this? The whole repository for Composer doesn't contain a single call of wget – Nico Haase Aug 12 '21 at 08:53
  • Composer is a PHP Script that uses an HTTP client installed on the computer. Often this type of issue is caused by the HTTP client configuration. On my linux, I have curl and wget installed and it's the wget configuration used that is why configuring wget can help. – allema_s Aug 12 '21 at 13:50
  • Please add all clarification to your question by editing it. I cannot see any reference that Composer uses the HTTP client of your computer. It rather uses cURL or file_get_contents. Do you have any information about Composer using wget? – Nico Haase Aug 12 '21 at 13:55