我刚刚在我的虚拟主机中添加了一个环境变量,并在parameters.yml
中添加了对它的引用。但是当我清除缓存时,我得到了这个:
[Symfony的\元器件\ DependencyInjection \异常\ ParameterNotFoundException] 您已请求不存在的参数" email.password"。你是否 意思是:" mailer_password"?
# parameters.yml
parameters:
database_host: 127.0.0.1
database_port: null
database_name: domain
database_user: root
database_password: *****
mailer_transport: gmail
mailer_host: ~
mailer_user: domain@gmail.com
mailer_password: %email.password%
secret: *****
#virtual host
<VirtualHost *:80>
ServerName www.domain.com
ServerAlias domain.com
DocumentRoot /home/sedigital/domain/web
DirectoryIndex app.php
SetEnv SYMFONY__EMAIL__PASSWORD "*****"
<Directory /home/sedigital/domain/web/>
# Options Indexes FollowSymLinks MultiViews
AllowOverride All
#Order allow,deny
#allow from all
Require all granted
FallbackResource /index.php
# BEGIN EXPIRES
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 10 days"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/plain "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType application/x-icon "access plus 1 year"
</IfModule>
# END EXPIRES
</Directory>
</VirtualHost>
我也跑了:$ export SYMFONY__EMAIL__PASSWORD=*****
我在Ubuntu 14.04和Apache 2.4.7
编辑:最后它正在运行,也许我忘记在$ export SYMFONY__EMAIL__PASSWORD=*****
之后重新启动Apache。