处理 symfony-scripts 事件的脚本 Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache 因异常而终止

Posted

技术标签:

【中文标题】处理 symfony-scripts 事件的脚本 Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache 因异常而终止【英文标题】:Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception处理 symfony-scripts 事件的脚本 Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache 因异常而终止 【发布时间】:2018-11-01 06:15:47 【问题描述】:

Heroku 日志:

   > Incenteev\ParameterHandler\ScriptHandler::buildParameters

   Creating the "app/config/parameters.yml" file

   > Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap

   > Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache



   In AbstractmysqlDriver.php line 103:



     An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused  





   In PDOConnection.php line 47:



     SQLSTATE[HY000] [2002] Connection refused  





   In PDOConnection.php line 43:



     SQLSTATE[HY000] [2002] Connection refused  





   Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception





     [RuntimeException]                                                             

     An error occurred when executing the "'cache:clear --no-warmup'" command:      









     In AbstractMySQLDriver.php line 103:                                           



       An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused    





     In PDOConnection.php line 47:                                                  



       SQLSTATE[HY000] [2002] Connection refused                                    





     In PDOConnection.php line 43:                                                  



       SQLSTATE[HY000] [2002] Connection refused                                    





   install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...



 !     Push rejected, failed to compile PHP app.

 !     Push failed

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache 处理 symfony-scripts 事件并以异常终止

[运行时异常]

执行“'cache:clear --no-warmup'”命令时出错

composer.json:


    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": 
        "psr-4": 
            "AppBundle\\": "src/AppBundle"
        ,
        "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
    ,
    "autoload-dev": 
        "psr-4":  "Tests\\": "tests/" ,
        "files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
    ,
    "require": 
        "php": ">=5.5.9",
        "doctrine/doctrine-bundle": "^1.6",
        "doctrine/orm": "^2.5",
        "easycorp/easyadmin-bundle": "^1.17",
        "friendsofsymfony/user-bundle": "~2.0",
        "incenteev/composer-parameter-handler": "^2.0",
        "knplabs/knp-paginator-bundle": "^2.7",
        "mgilet/notification-bundle": "^2.0",
        "sensio/distribution-bundle": "^5.0.19",
        "sensio/framework-extra-bundle": "^5.0.0",
        "symfony/assetic-bundle": "^2.8",
        "symfony/monolog-bundle": "^3.1.0",
        "symfony/polyfill-apcu": "^1.0",
        "symfony/swiftmailer-bundle": "^2.6.4",
        "symfony/symfony": "3.4.*",
        "symfony/var-dumper": "^3.4",
        "ext-apcu": "^5.1.7",
        "twig/twig": "^1.0||^2.0",
        "vich/uploader-bundle": "^1.4",
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^3.0"

    ,
    "require-dev": 
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^3.0"
    ,
    "scripts": 
        "symfony-scripts": [
            "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::prepareDeploymentTarget"
        ],
        "post-install-cmd": [
            "@symfony-scripts"
        ],
        "post-update-cmd": [
            "@symfony-scripts"
        ]
    ,
    "config": 
        "platform": 
            "php": "5.5.9"
        ,
        "sort-packages": true
    ,
    "extra": 
        "symfony-app-dir": "app",
        "symfony-bin-dir": "bin",
        "symfony-var-dir": "var",
        "symfony-web-dir": "web",
        "symfony-tests-dir": "tests",
        "symfony-assets-install": "relative",
        "incenteev-parameters": 
            "file": "app/config/parameters.yml"
        ,
        "branch-alias": 
            "dev-master": "3.4-dev"
        
    

我更新了 composer 添加了一个 require ext-apcu 和 require generator bundle

知道问题出在哪里,而且似乎不是很常见。

【问题讨论】:

【参考方案1】:

可能 Doctrine 正在尝试确定数据库平台版本。

尝试将服务器版本添加到 Doctrine DBAL 配置中(请参阅此处的答案:https://***.com/a/34024275/695091):

#config.yml

doctrine:
    dbal:
    ...
        server_version: 5.7

【讨论】:

以上是关于处理 symfony-scripts 事件的脚本 Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache 因异常而终止的主要内容,如果未能解决你的问题,请参考以下文章

sql 获取批处理信息的脚本(优化器在处理批处理时所发生的优化器事件)

学习 MeteorJS 试图制作我自己的转换脚本...卡在事件处理上

WSO2工具(eclipse)错误未处理的事件循环异常:带有groovy脚本的脚本调解器

如何修复 thix 批处理脚本

插入到 sql 的按钮:事件处理程序不在命名空间中或脚本中有错误

测试工具研发_脚本:事件处理2