尝试安装 symfony 2 composer 时出错 [重复]

Posted

技术标签:

【中文标题】尝试安装 symfony 2 composer 时出错 [重复]【英文标题】:Error when trying to install symfony 2 composer [duplicate] 【发布时间】:2015-07-03 08:39:09 【问题描述】:

配置文件app/config/parameters.ymlNEXT后报错,如何解决?

直接通过 composer 安装 symfony:

Generating autoload files
Would you like to install Acme demo bundle? [y/N] y
Installing the Acme demo bundle.
Creating the "app/config/parameters.yml" file
Some parameters are missing. Please provide them.
database_driver (pdo_mysql): 
database_host (127.0.0.1): localhost
database_port (null): 
database_name (symfony): curso_sf
database_user (root): 
database_password (null): @admin1
mailer_transport (smtp): 
mailer_host (127.0.0.1): localhost
mailer_user (null): 
mailer_password (null): 
locale (en): es
secret (ThisTokenIsNotSoSecretChangeIt): curso_sf!

[Symfony\Component\Config\Definition\Exception\InvalidTypeException]                                  
Invalid type for path "doctrine.dbal.connections.default.password". 
Expected scalar, but got object.  

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

[RuntimeException]                                                         

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

【问题讨论】:

它很可能不喜欢您密码中的@符号 @ 符号表示服务 【参考方案1】:

您必须通过将@@ 加倍来逃避@,如documentation 中所述:

parameters:
    # ...
    database_password : "@@admin1"

感谢 Falc 提供his/her answer。

【讨论】:

以上是关于尝试安装 symfony 2 composer 时出错 [重复]的主要内容,如果未能解决你的问题,请参考以下文章

加载 Symfony 2.8.3 时,travis+composer 反复失败

无法通过 composer 和 flex 安装 symfony/console:3.2

运行 composer install 命令时出错

安装 symfony2 cmf composer 问题

在 Symfony 5 中使用 composer 安装 EasyAdmin 的问题

php composer.phar 更新不适用于 Symfony 安装