代理后面的Composer不适用于symfony项目

时间:2014-07-24 20:05:00

标签: symfony proxy composer-php

在我的工作场所网络中,我们必须使用代理。我想使用Composer a来下载我的Symfony2项目的一些包依赖项。即使在使用代理信息声明环境变量之后,它也不起作用。我注意到我们也无法使用公司的DNS旋转任何外部名称。而且我认为一个主要问题并不能让我们用作曲家下载。 事实是,我不能改变公司的那些服务器或政策上的任何东西。 您是否认为我可以做一些可以让我解析这些名称或访问这些资源来安装依赖项的东西? 这是错误:

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
 [Composer\Downloader\TransportException]                                                                     

  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]

然后composer.json文件就是这个:

{
"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"
    }
}
}

添加作曲家诊断:

root@zeus:/home/abel/Documents/http/team# php composer.phar diag
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity: FAIL
[Composer\Downloader\TransportException] 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
[Composer\Downloader\TransportException] 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: 


  [Composer\Downloader\TransportException]                                                                     
  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# 

此外,我尝试在我的etc主机上声明ipag的Packagist.org ...然后我注意到使用的DNS不是我的localhost:

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



  [Composer\Downloader\TransportException]                                                                     
  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# 

1 个答案:

答案 0 :(得分:4)

我曾遇到过同样的问题,在我的终端设置代理解决了这个问题。

如果您使用的是Windows,请输入以下命令:

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

在Unix系统中,命令为export而不是set

然后你可以运行composer update命令。

如果您仍有问题,可能是git也需要代理配置。 在%HOMEPATH%\.gitconfig中,添加以下内容:

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

修改

由于您添加了composer diag的结果,问题似乎是您的代理不处理HTTPS请求的request_fulluri标记。

您可以通过设置环境变量HTTPS_PROXY_REQUEST_FULLURI(Unix系统)来禁用此选项:

set HTTPS_PROXY_REQUEST_FULLURI=0