我正在尝试验证我的Symfony 3项目,但是我对作曲家脚本有错误:
sensiolabsinsight无法安装您的作曲家依赖项。如果您需要自定义文件或运行命令以使其正常工作,则可以编辑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
> IncenteevParameterHandlerScriptHandler::buildParameters
Creating the "app/config/parameters.yml" file
> SensioBundleDistributionBundleComposerScriptHandler::buildBootstrap
> SensioBundleDistributionBundleComposerScriptHandler::clearCache
[DoctrineDBALExceptionConnectionException]
An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused
[DoctrineDBALDriverPDOException]
SQLSTATE[HY000] [2002] Connection refused
[PDOException]
SQLSTATE[HY000] [2002] Connection refused
Script SensioBundleDistributionBundleComposerScriptHandler::clearCache handling the symfony-scripts event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
[DoctrineDBALExceptionConnectionException]
An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused
[DoctrineDBALDriverPDOException]
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需要连接到数据库。
对我来说同样的问题,该问题会影响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问题
清除缓存后,Symfony试图启动内核。这包括连接到数据库。
安装项目的依赖项时,作曲家安装 命令被执行。反过来,此命令执行缓存:清除 命令,尝试启动应用程序的内核。
https://insight.sensiolabs.com/help/#how-can-i-connect-to-a-database
我遇到了相同的问题,决定在我的测试环境中使用内存中的pdo_sqlite
数据库(我已经在其他某个地方使用了),但是您也可以使用mongodb,redis或memcached。