当我运行 php -d memory_limit = 2G ../composer/composer.phar install 时,我会遇到有关非存在参数" database_driver"的错误范围。但是,如果我从我的参数中删除所有引用。
ParameterNotFoundException in ParameterBag.php line 84:
You have requested a non-existent parameter "database_driver".
Did you mean one of these: "database_name", "database_user"?
所以我很清楚我需要这个参数。
我在我的 parameters.yml and parameters.yml.dist 文件中定义了" database_driver"。>文件。
**我需要更改什么才能成功运行'Composer install命令?
注意:我还看到" Composer install"命令的下面输出说我的Composer.lock文件已过时并运行" Composer Update"命令,但是当我这样做时,它会失败。出于内存错误,这是没有意义的,因为我在服务器上有三场记忆,超过28次免费的磁盘空间!如果可能的话,我想尝试第一个**
尝试求解"数据库_驱动程序"。这是的输出 这是我的 parameters.yml.dist 文件: 这是我的 parameters.yml 文件: 这是我的 config.yml 文件: 这是我的 config_dev.yml 文件: 最后,这是我的 composer.json 文件的内容: 感谢您在此问题上的任何帮助。Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in
composer.json. You may be getting outdated dependencies. Run update to
update them.
Nothing to install or update
Generating autoload files
> IncenteevParameterHandlerScriptHandler::buildParameters
Updating the "app/config/parameters.yml" file
> SensioBundleDistributionBundleComposerScriptHandler::buildBootstrap
> SensioBundleDistributionBundleComposerScriptHandler::clearCache
[SymfonyComponentDependencyInjectionExceptionParameterNotFoundException]
You have requested a non-existent parameter "database_driver". Did you
mean one of these: "database_name", "database_user"?
Script SensioBundleDistributionBundleComposerScriptHandler::clearCache
handling the symfony-scripts event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
[SymfonyComponentDependencyInjectionExceptionParameterNotFoundException]
You have requested a non-existent parameter "database_driver". Did you
mean one of these: "database_name", "database_user"?
# This file is a "template" of what your parameters.yml file should look like
# Set parameters here that may be different on each deployment target of the app,
# e.g. development, staging, production.
# http://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
parameters:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: 3306
database_name: ##########
database_user: ##########
database_password: ##########
# You should uncomment this if you want use pdo_sqlite
database_path: "%kernel.root_dir%/data.db3"
mailer_transport: smtp
mailer_host: smtp.sendgrid.net
mailer_user: #############
mailer_password: #############
locale: en
# A secret key that's used to generate certain security-related tokens
secret: ############################
# This file is auto-generated during the composer install
parameters:
database_driver: pdo_mysql
database_server_version: 15.1
database_host: 127.0.0.1
database_port: 3306
database_name: ##########
database_user: ##########
database_password: ##########
database_charset: UTF8
# You should uncomment this if you want use pdo_sqlite
database_path: "%kernel.root_dir%/data.db3"
mailer_transport: smtp
mailer_host: smtp.sendgrid.net
mailer_user: ##########
mailer_password: ##########
locale: en
# A secret key that's used to generate certain security-related tokens
secret: #######################
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
# Put parameters here that don't need to change on each machine where the
# app is deployed
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: en
framework:
#esi: ~
#translator: { fallbacks: ["%locale%"] }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
#serializer: { enable_annotations: true }
templating:
engines: ['twig']
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%"
# Doctrine Configuration
doctrine:
dbal:
driver: "%database_driver%"
server_version: "%database_server_version%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: "%database_charset%"
# 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%"
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
# Swiftmailer Configuration
##swiftmailer:
## transport: "%mailer_transport%"
## host: "%mailer_host%"
## username: "%mailer_user%"
## password: "%mailer_password%"
## port : “%mailer_port%”
## encryption: ~
## spool: { type: memory }
imports:
- { resource: config.yml }
framework:
router:
resource: "%kernel.root_dir%/config/routing_dev.yml"
strict_requirements: true
profiler: { only_exceptions: false }
web_profiler:
toolbar: true
intercept_redirects: true
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: [!event]
console:
type: console
channels: [!event, !doctrine]
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info
swiftmailer:
# delivery_address: ###@####.###
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The "Symfony Standard Edition" distribution",
"autoload": {
"psr-4": { "": "src/" },
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"require": {
"php": ">=5.6.0",
"symfony/symfony": "2.8.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"google/recaptcha": "~1.1",
"sendgrid/sendgrid": "~5.5"
},
"require-dev": {
"sensio/generator-bundle": "~3.0",
"symfony/phpunit-bridge": "~2.7"
},
"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": {
"bin-dir": "bin",
"platform": {
"php": "5.6.0"
}
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.8-dev"
}
}
}
@howard brown
我已经通过添加 database_driver 参数解决了此问题
我猜想每当我们更新 parameters.yml (使用应该在产品服务器上也应该很好的配置(时,您也必须更新文件参数。
以下是参数的示例结构。 示例: 有关更多信息 stackoverflow github问题parameters:
database_host: 127.0.0.1
database_port: *****
database_name: symfony
database_user: root
database_password: *****
database_driver: mysql