代理背后的作曲家不适用于 symfony 项目 [英] Composer behind proxy not working for symfony project

查看:24
本文介绍了代理背后的作曲家不适用于 symfony 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

In my workplace network we have to use a proxy. I want to use Composer a to download some package dependencies for my Symfony2 projects. It does not work even after declaring the environment variable with the proxy information. I noticed that we are also unable to revolve any external name using the DNS of the company. And I think that one is the main problem that does not alow us to download with composer. The truth is that I can not change any thing on those servers or policies of the company. Do you think that I can do something that can let me resolve those names or access those resources to install the dependencies? this is the error:

The "http://thirds.packagist.dev/packages.json" file could not be downloaded (HTTP/1.0 503 Service Unavailable)

http://thirds.packagist.dev could not be fully loaded, package information was loaded from the local cache and may be out of date
 [ComposerDownloaderTransportException]                                                                     

  The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. O  

  penSSL Error messages:                                                                                       

  error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure                             

  failed to open stream: Cannot connect to HTTPS server through proxy                                          



update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [packagesN]

Then the composer.json file is this one:

{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The "Symfony Standard Edition" distribution",
"autoload": {
    "psr-0": { "": "src/" }
},
 "repositories": [
    {            
        "type": "composer",
        "url": "http://thirds.packagist.dev"
    }
],
"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "~2.4",
    "doctrine/orm": "~2.2,>=2.2.3",
    "doctrine/doctrine-bundle": "~1.2",
    "twig/extensions": "~1.0",
    "symfony/assetic-bundle": "~2.3",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.4",
    "sensio/distribution-bundle": "~2.3",
    "sensio/framework-extra-bundle": "~3.0",
    "sensio/generator-bundle": "~2.3",
    "incenteev/composer-parameter-handler": "~2.0",
    "friendsofsymfony/user-bundle": "1.3.4",
    "sylius/resource-bundle": "*",
    "friendsofsymfony/jsrouting-bundle": "*",
    "genemu/form-bundle": "2.2.*"
},
"scripts": {
    "post-install-cmd": [
        "Incenteev\ParameterHandler\ScriptHandler::buildParameters",
        "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
        "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
        "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
        "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile"
    ],
    "post-update-cmd": [
        "Incenteev\ParameterHandler\ScriptHandler::buildParameters",
        "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
        "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
        "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
        "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile"
    ]
},
"config": {
    "bin-dir": "bin"
},
"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "incenteev-parameters": {
        "file": "app/config/parameters.yml"
    },
    "branch-alias": {
        "dev-master": "2.4-dev"
    }
}
}

Adding composer diag:

root@zeus:/home/abel/Documents/http/team# php composer.phar diag
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity: FAIL
[ComposerDownloaderTransportException] The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
failed to open stream: Cannot connect to HTTPS server through proxy
Checking HTTP proxy: FAIL
[ComposerDownloaderTransportException] The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
failed to open stream: Cannot connect to HTTPS server through proxy
Checking HTTP proxy support for request_fulluri: OK
Checking HTTPS proxy support for request_fulluri: FAIL
Unable to assert the situation, maybe github is down (The "https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0" file could not be downloaded: Peer certificate CN=`*.github.com' did not match expected CN=`201.220.215.11'
failed to open stream: Cannot connect to HTTPS server through proxy)
Checking composer.json: OK
Checking disk free space: OK
Checking composer version: 


  [ComposerDownloaderTransportException]                                                                     
  The "https://getcomposer.org/version" file could not be downloaded: SSL operation failed with code 1. OpenS  
  SL Error messages:                                                                                           
  error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure                             
  failed to open stream: Cannot connect to HTTPS server through proxy                                          



diagnose


root@zeus:/home/abel/Documents/http/team# 

Also I tried to declared the ip of packagist.org on my etc hosts... and then i notices that the DNS that is used is not the one of my localhost:

root@zeus:/home/abel/Documents/http/team# php composer.phar update
Loading composer repositories with package information



  [ComposerDownloaderTransportException]                                                                     
  The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection t  
  imed out                                                                                                     



update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [packagesN]


root@zeus:/home/abel/Documents/http/team# cat /etc/hosts
127.0.0.1   localhost
201.220.207.218 zeus.ltu.sld.cu zeus
127.0.0.1       thirds.packagist.dev
127.0.0.1       abel.ltu.sld.cu
87.98.253.214   packagist.org
# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
root@zeus:/home/abel/Documents/http/team# 

解决方案

I once faced the same issue, and setting the proxy in my terminal solved the problem.

If you're using Windows, enter these commands :

set HTTP_PROXY=http://user:password@proxy.domain.com:port
set HTTPS_PROXY=http://user:password@proxy.domain.com:port

In Unix system, the command is export instead of set.

Then you can run composer update command.

If you still have problems, it might be git that needs the proxy configuration too. In your %HOMEPATH%.gitconfig, add the following :

[http]
    proxy = http://user:password@proxy.domain.com:port

EDIT:

Since you've added the results of composer diag, the problem seems to be that your proxy doesn't handle the request_fulluri flag for HTTPS requests.

You can disable this option by setting the environment variable HTTPS_PROXY_REQUEST_FULLURI like this (Unix system) :

set HTTPS_PROXY_REQUEST_FULLURI=0

这篇关于代理背后的作曲家不适用于 symfony 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆