2015-01-01 6 views
1

Heroku에 symfony2 앱을 계속 배포하려고하는데 이러한 오류가 계속 발생합니다. 나는 일주일 내내이 일을 해왔습니다. 누군가 내가 뭘 잘못하고 있는지 말해주십시오. 몇 가지 중요한 파일을 포함 할 것입니다. 나에게 다른 것을 포함시킬 필요가 있다면 알려줘. 감사! 특히캔트가 Heroku에 Symfony 앱을 배포

이 4 오류 :

[교리 \ DBAL \ 예외 \의 ConnectionException]
드라이버에서 발생 예외 : SQLSTATE [HY000] [2002] 해당 파일이나 디렉토리

[교리 \ DBAL \ 드라이버 \의 PDOException]
SQLSTATE [HY000] [2002] 해당 파일이나 디렉토리

[PDOException]
SQLSTATE [HY000] [2002] 이러한 파일이 없습니다 또는 디렉토리

스크립트 Sensio \ 번들 \ DistributionBundle \ 작곡가 후 설치-CMD 이벤트를 처리 ScriptHandler :: installAssets 예외 종료 \

이 내 composer.json 파일입니다 : 이것은 내 appKernel.php 파일이

{ 
"name": "symfony/framework-standard-edition", 
"license": "MIT", 
"type": "project", 
"description": "The \"Symfony Standard Edition\" distribution", 
"autoload": { 
    "psr-0": { "": "src/", "SymfonyStandard": "app/" } 
}, 
"require": { 
    "php": ">=5.3.3", 
    "symfony/symfony": "~2.5", 
    "doctrine/orm": "~2.2,>=2.2.3", 
    "doctrine/doctrine-bundle": "~1.2", 
      "doctrine/doctrine-fixtures-bundle": "2.2.*", 
      "doctrine/doctrine-migrations-bundle": "dev-master", 
      "doctrine/migrations": "dev-master", 
    "twig/extensions": "~1.0", 
    "symfony/assetic-bundle": "~2.3", 
    "symfony/swiftmailer-bundle": "~2.3", 
    "symfony/monolog-bundle": "~2.4", 
    "sensio/distribution-bundle": "~3.0", 
    "sensio/framework-extra-bundle": "~3.0", 
    "incenteev/composer-parameter-handler": "~2.0", 
      "ircmaxell/password-compat": "~1.0.3", 
    "friendsofsymfony/user-bundle": "~1.3" 
}, 
"require-dev": { 
    "sensio/generator-bundle": "~2.3", 
      "phpunit/phpunit": "3.7.*" 
}, 
"scripts": { 
    "post-root-package-install": [ 
     "SymfonyStandard\\Composer::hookRootPackageInstall" 
    ], 
    "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", 
     "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles" 
    ], 
    "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", 
     "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles" 
    ] 
}, 
"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.5-dev" 
    } 
} 
} 

입니다

,994,771,946,321 0

이 내 config.yml 파일입니다

imports: 
- { resource: parameters.yml } 
- { resource: security.yml } 
- { resource: @BloggerBlogBundle/Resources/config/config.yml } 

framework: 
#esi:    ~ 
translator:  { fallback: "%locale%" } 
secret:   "%secret%" 
router: 
    resource: "%kernel.root_dir%/config/routing.yml" 
    strict_requirements: ~ 
form:   ~ 
csrf_protection: ~ 
validation:  { enable_annotations: true } 
templating: 
    engines: ['twig'] 
    #assets_version: SomeVersionScheme 
default_locale: "%locale%" 
trusted_hosts: ~ 
trusted_proxies: ~ 
session: 
    # handler_id set to null will use default session handler from php.ini 
    handler_id: ~ 
fragments:  ~ 
http_method_override: true 

# Twig Configuration 
twig: 
debug:   "%kernel.debug%" 
strict_variables: "%kernel.debug%" 

# Assetic Configuration 
assetic: 
debug:   "%kernel.debug%" 
use_controller: false 
bundles:  [BloggerBlogBundle] 
#java: /usr/bin/java 
filters: 
    cssrewrite: ~ 
    #closure: 
    # jar: "%kernel.root_dir%/Resources/java/compiler.jar" 
    #yui_css: 
    # jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar" 

# Doctrine Configuration 
doctrine: 
dbal: 
    driver: "%database_driver%" 
    host:  "%database_host%" 
    port:  "%database_port%" 
    dbname: "%database_name%" 
    user:  "%database_user%" 
    password: "%database_password%" 
    charset: UTF8 
    # if using pdo_sqlite as your database driver: 
    # 1. add the path in parameters.yml 
    #  e.g. database_path: "%kernel.root_dir%/data/data.db3" 
    # 2. Uncomment database_path in parameters.yml.dist 
    # 3. Uncomment next line: 
    #  path:  "%database_path%" 

orm: 
    auto_generate_proxy_classes: "%kernel.debug%" 
    auto_mapping: true 

# Swiftmailer Configuration 
swiftmailer: 
transport: "%mailer_transport%" 
host:  "%mailer_host%" 
username: "%mailer_user%" 
password: "%mailer_password%" 
encryption: ssl 
# spool:  { type: memory } 

# configuration for fos user bundle 
fos_user: 
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel' 
firewall_name: demo_fos_login 
user_class: Blogger\UserBundle\Entity\User 

그리고 이것은에게 Heroku에서 오류 로그입니다 : 당신이 당신의 Heroku가 인스턴스에 cleardb의 부가 기능을 추가하지 않은 것처럼

-----> PHP app detected 
-----> Resolved composer.lock requirement for PHP to version 5.6.4. 
-----> Installing system packages... 
    - PHP 5.6.4 
    - Apache 2.4.10 
    - Nginx 1.6.0 
-----> Installing PHP extensions... 
    - zend-opcache (automatic; bundled) 
-----> Installing dependencies... 
    Composer version 1.0.0-alpha9 2014-12-07 17:15:20 
    Loading composer repositories with package information 
    Installing dependencies from lock file 
    - Installing doctrine/lexer (v1.0) 
     Downloading: connection... Downloading: 0%    Downloading: 80%  Downloading: 100% 

    - Installing doctrine/annotations (v1.2.3) 
     Downloading: connection... Downloading: 0%    Downloading: 10% Downloading: 20% Downloading: 30% Downloading: 40% Downloading: 50% Downloading: 60% Downloading: 70% Downloading: 80% Downloading: 90% Downloading: 100% 

    - Installing twig/twig (v1.16.3) 
     Downloading: connection... Downloading: 0%    Downloading: 5% Downloading: 10% Downloading: 15% Downloading: 20% Downloading: 25% Downloading: 30% Downloading: 35% Downloading: 40% Downloading: 45% Downloading: 50% Downloading: 55% Downloading: 60% Downloading: 65% Downloading: 70% Downloading: 75% Downloading: 80% Downloading: 85% Downloading: 90% Downloading: 95% Downloading: 100% Downloading: 100% 

    - Installing psr/log (1.0.0) 
     Downloading: connection... Downloading: 0%    Downloading: 15% Downloading: 30% Downloading: 45% Downloading: 60% Downloading: 75% Downloading: 100% 

    - Installing doctrine/inflector (v1.0.1) 
     Downloading: connection... Downloading: 0%    Downloading: 60% Downloading: 100% 

    - Installing doctrine/collections (v1.2) 
     Downloading: connection... Downloading: 0%    Downloading: 35% Downloading: 70% Downloading: 100% 

    - Installing doctrine/cache (v1.3.1) 
     Downloading: connection... Downloading: 0%    Downloading: 20% Downloading: 25% Downloading: 40% Downloading: 45% Downloading: 65% Downloading: 85% Downloading: 100% 

    - Installing doctrine/common (v2.4.2) 
     Downloading: connection... Downloading: 0%    Downloading: 5% Downloading: 10% Downloading: 15% Downloading: 20% Downloading: 25% Downloading: 30% Downloading: 35% Downloading: 40% Downloading: 45% Downloading: 50% Downloading: 55% Downloading: 60% Downloading: 65% Downloading: 70% Downloading: 75% Downloading: 80% Downloading: 85% Downloading: 90% Downloading: 95% Downloading: 100% 

    - Installing symfony/symfony (v2.6.1) 
     Downloading: connection... Downloading: 0%    Downloading: 5% Downloading: 10% Downloading: 15% Downloading: 20% Downloading: 25% Downloading: 30% Downloading: 35% Downloading: 40% Downloading: 45% Downloading: 50% Downloading: 55% Downloading: 60% Downloading: 65% Downloading: 70% Downloading: 75% Downloading: 80% Downloading: 85% Downloading: 90% Downloading: 95% Downloading: 100% Downloading: 100% 

    - Installing doctrine/doctrine-cache-bundle (v1.0.1) 
     Downloading: connection... Failed to download doctrine/doctrine-cache-bundle from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing doctrine/doctrine-cache-bundle (v1.0.1) 
     Cloning e4b6f810aa047f9cbfe41c3d6a3d7e83d7477a9d 

    - Installing jdorn/sql-formatter (v1.2.17) 
     Downloading: connection... Failed to download jdorn/sql-formatter from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing jdorn/sql-formatter (v1.2.17) 
     Cloning 64990d96e0959dff8e059dfcdc1af130728d92bc 

    - Installing doctrine/dbal (v2.5.0) 
     Downloading: connection... Failed to download doctrine/dbal from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing doctrine/dbal (v2.5.0) 
     Cloning 71140662c0a954602e81271667b6e03d9f53ea34 

     Skipped installation of bin bin/doctrine-dbal for package doctrine/dbal: name conflicts with an existing file 
    - Installing doctrine/doctrine-bundle (v1.3.0) 
     Downloading: connection... Failed to download doctrine/doctrine-bundle from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing doctrine/doctrine-bundle (v1.3.0) 
     Cloning 3beb3a780485ab01f86941f4892cd23ef8c39c6b 

    - Installing doctrine/data-fixtures (v1.0.0) 
     Downloading: connection... Failed to download doctrine/data-fixtures from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing doctrine/data-fixtures (v1.0.0) 
     Cloning b4a135c7db56ecc4602b54a2184368f440cac33e 

    - Installing doctrine/doctrine-fixtures-bundle (v2.2.0) 
     Downloading: connection... Failed to download doctrine/doctrine-fixtures-bundle from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing doctrine/doctrine-fixtures-bundle (v2.2.0) 
     Cloning c811f96f0cf83b997e3a3ed037cac729bbe3e803 

    - Installing doctrine/migrations (dev-master 96f838b) 
     Downloading: connection... Failed to download doctrine/migrations from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing doctrine/migrations (dev-master 96f838b) 
     Cloning 96f838b4fa93693d19196c8e24ed5f1c3972ba87 

    - Installing doctrine/doctrine-migrations-bundle (dev-master 81575a4) 
     Downloading: connection... Failed to download doctrine/doctrine-migrations-bundle from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing doctrine/doctrine-migrations-bundle (dev-master 81575a4) 
     Cloning 81575a4316951125ce408c70f30547c77d98f78a 

    - Installing doctrine/orm (v2.4.7) 
     Downloading: connection... Failed to download doctrine/orm from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing doctrine/orm (v2.4.7) 
     Cloning 2bc4ff3cab2ae297bcd05f2e619d42e6a7ca9e68 

     Skipped installation of bin bin/doctrine for package doctrine/orm: name conflicts with an existing file 
     Skipped installation of bin bin/doctrine.php for package doctrine/orm: name conflicts with an existing file 
    - Installing friendsofsymfony/user-bundle (v1.3.5) 
     Downloading: connection... Failed to download friendsofsymfony/user-bundle from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing friendsofsymfony/user-bundle (v1.3.5) 
     Cloning d66890ad3489e18be153502c5ccc3f2bf5cce442 

    - Installing incenteev/composer-parameter-handler (v2.1.0) 
     Downloading: connection... Failed to download incenteev/composer-parameter-handler from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing incenteev/composer-parameter-handler (v2.1.0) 
     Cloning 143272a0a09c62616a3c8011fc165a10c6b35241 

    - Installing ircmaxell/password-compat (v1.0.4) 
     Downloading: connection... Failed to download ircmaxell/password-compat from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing ircmaxell/password-compat (v1.0.4) 
     Cloning 5c5cde8822a69545767f7c7f3058cb15ff84614c 

    - Installing sensiolabs/security-checker (v2.0.0) 
     Downloading: connection... Failed to download sensiolabs/security-checker from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing sensiolabs/security-checker (v2.0.0) 
     Cloning 5b4eb4743ebe68276c911c84101ecdf4a9ae76ee 

     Skipped installation of bin security-checker for package sensiolabs/security-checker: name conflicts with an existing file 
    - Installing sensio/distribution-bundle (v3.0.14) 
     Downloading: connection... Failed to download sensio/distribution-bundle from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing sensio/distribution-bundle (v3.0.14) 
     Cloning dc20d5ab3251587b047859ca2fc06c1b88a38d00 

    - Installing sensio/framework-extra-bundle (v3.0.4) 
     Downloading: connection... Failed to download sensio/framework-extra-bundle from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing sensio/framework-extra-bundle (v3.0.4) 
     Cloning b3bc3e67c8b6b68b18d727012183520d35ee762a 

    - Installing kriswallsmith/assetic (v1.2.1) 
     Downloading: connection... Failed to download kriswallsmith/assetic from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing kriswallsmith/assetic (v1.2.1) 
     Cloning b20efe38845d20458702f97f3ff625d80805897b 

    - Installing symfony/assetic-bundle (v2.5.0) 
     Downloading: connection... Failed to download symfony/assetic-bundle from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing symfony/assetic-bundle (v2.5.0) 
     Cloning 90ea7fb66d6d5245fd4afc16e4c8070214254fec 

    - Installing monolog/monolog (1.12.0) 
     Downloading: connection... Failed to download monolog/monolog from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing monolog/monolog (1.12.0) 
     Cloning 1fbe8c2641f2b163addf49cc5e18f144bec6b19f 

    - Installing symfony/monolog-bundle (v2.7.0) 
     Downloading: connection... Failed to download symfony/monolog-bundle from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing symfony/monolog-bundle (v2.7.0) 
     Cloning e8f71c91a3784f3fa1a75fb1f7f4d4826c5f2773 

    - Installing swiftmailer/swiftmailer (v5.3.1) 
     Downloading: connection... Failed to download swiftmailer/swiftmailer from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing swiftmailer/swiftmailer (v5.3.1) 
     Cloning c5f963e7f9d6f6438fda4f22d5cc2db296ec621a 

    - Installing symfony/swiftmailer-bundle (v2.3.8) 
     Downloading: connection... Failed to download symfony/swiftmailer-bundle from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing symfony/swiftmailer-bundle (v2.3.8) 
     Cloning 970b13d01871207e81d17b17ddda025e7e21e797 

    - Installing twig/extensions (v1.2.0) 
     Downloading: connection... Failed to download twig/extensions from dist: Could not authenticate against github.com 
     Now trying to download from source 
    - Installing twig/extensions (v1.2.0) 
     Cloning 8cf4b9fe04077bd54fc73f4fde83347040c3b8cd 

    Generating optimized autoload files 
    Updating the "app/config/parameters.yml" file 
    Clearing the cache for the prod environment with debug false 



    [Doctrine\DBAL\Exception\ConnectionException]          
    An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory 






    [Doctrine\DBAL\Driver\PDOException]    
    SQLSTATE[HY000] [2002] No such file or directory 






    [PDOException]          
    SQLSTATE[HY000] [2002] No such file or directory 

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets 
handling the post-install-cmd event terminated with an exception  

[RuntimeException]                
An error occurred when executing the "'assets:install '\''web'\'''" command. 

!  Push rejected, failed to compile PHP app 

답변

2

보인다

heroku addons:add cleardb:ignite 
0

Google에서 "SQLSTATE [HY000] [2002] No such file or directory"메시지 만 검색하면 신속하게 설명을 찾을 수 있습니다 : Unix 도메인 소켓을 통한 MySQL 연결이 실패했습니다. /var/sock/mysql.sock은 존재하지 않습니다 (MySQL은 localhost에 연결하려고 시도하고, 127.0.0.1에 연결하면 TCP/IP 소켓을 사용합니다).

어쨌든 문제는 대부분 prod 환경에서 데이터베이스 자격 증명을 설정했지만이 자격 증명은 localhost MySQL에 연결하려고 시도하기 때문에 유효하지 않습니다.

config_prod.yml 파일 내 로컬 서버에 대한 내 데이터베이스 구성 정보를 포함 parameters.yml 파일을 가져 내 config.yml 파일을 가져 : 여기

2

내가이 문제를 해결하기 위해 한 일이다.

라이브 서버 (heroku 또는 다른 서버)에 업로드 할 때 parameters.yml 파일을 새 데이터베이스 용으로 구성해야합니다.

옵션 1 (쉽게 수정) : 당신은 당신의 parameters.yml 파일에 데이터베이스 설정을 변경할 수 있습니다은 Heroku가에 대한 cleardb:ignite 데이터베이스와 일치합니다. 데이터베이스 구성 정보를 다시 변경하지 않으면 로컬 서버에서 작동하지 않습니다.

옵션 2 : 다른 parameters.yml 파일을 만들고 다른 이름을 지정할 수 있습니다. 즉 production_parmaeters.yml을 입력하고 파일을 config_prod.yml 파일로 가져 오십시오. c onfig_dev.yml 파일에 현지 개발 데이터베이스 구성이있는 원래 parameters.yml 파일이 포함되어 있는지 확인하십시오.

는 다음 주 config.yml 파일에

- { resource: parameters.yml } 

을 삭제합니다.

도와 주셔서 감사합니다.

관련 문제