SensioLabsInsight无法连接到数据库

时间:2017-02-20 11:47:28

标签: composer-php symfony

我正在尝试验证我的Symfony 3项目但是我在编写器脚本时遇到错误:

  

SensioLabsInsight无法安装Composer依赖项。如果您需要自定义文件或运行命令以使其工作,您可以编辑SensioLabsInsight项目配置以覆盖默认的“pre_composer_script”和/或“post_composer_script”设置。

这是错误:

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating optimized autoload files
> Incenteev\ParameterHandler\ScriptHandler::buildParameters
Creating the "app/config/parameters.yml" file
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache

  [Doctrine\DBAL\Exception\ConnectionException]                              
  An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused  

  [Doctrine\DBAL\Driver\PDOException]        
  SQLSTATE[HY000] [2002] Connection refused  

  [PDOException]                             
  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:      

    [Doctrine\DBAL\Exception\ConnectionException]                                
    An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused    

    [Doctrine\DBAL\Driver\PDOException]                                          
    SQLSTATE[HY000] [2002] Connection refused                                    

    [PDOException]                                                               
    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>]...

我不知道为什么SensioLabsInsight需要连接到数据库。

2 个答案:

答案 0 :(得分:1)

对我来说同样的问题,显然这个问题会影响DBAL 2.5

所以你必须在config.yml中添加服务器版本

doctrine:
dbal:
    driver:   pdo_mysql
    host:     "%database_host%"
    port:     "%database_port%"
    dbname:   "%database_name%"
    user:     "%database_user%"
    password: "%database_password%"
    charset:  UTF8
    server_version: 5.6

GitHub issue

答案 1 :(得分:0)

清除缓存后,Symfony尝试启动内核。这包括连接数据库。

  

安装项目的依赖项时,编译器安装   执行命令。反过来,此命令执行缓存:清除   命令,尝试启动应用程序的内核

https://insight.sensiolabs.com/help/#how-can-i-connect-to-a-database

我遇到了同样的问题并且决定在我的测试环境中使用内存中的<Style TargetType="TreeViewItem"> <Setter Property="Tag" Value="{Binding RelativeSource={RelativeSource AncestorType=TreeView}}" /> <Setter Property="ContextMenu"> <Setter.Value> <ContextMenu> <MenuItem Header="Remove" cal:Action.TargetWithoutContext="{Binding Path=PlacementTarget.Tag.DataContext, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}" cal:Message.Attach="[Event Click] = [Action RemoveResource()]"/> </ContextMenu> </Setter.Value> </Setter> </Style> 数据库(我已经在其他地方使用过了),但你也可以使用MongoDB,Redis或Memcached。

相关问题