简体   繁体   中英

Symfony3 does not read the environment variables on Elastic Beanstalk

Everything works fine on my local machine. printenv | grep SYMFONY printenv | grep SYMFONY on my local machine prints me this

SYMFONY__DATABASE_HOST=127.0.0.1
SYMFONY__DATABASE_NAME=database
SYMFONY__DATABASE_PASSWORD=root
SYMFONY__DATABASE_PORT=3306
SYMFONY__DATABASE_USER=root

My config.yml contains the following configuration:

# Doctrine Configuration
doctrine:
    dbal:
        driver:   pdo_mysql
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"

On my ec2 machine printenv | grep SYMFONY printenv | grep SYMFONY prints the same as above.

我的弹性beantalk环境变量

But i get the following error message

$ sudo bin/console doctrine:schema:update --force 

[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
      You have requested a non-existent parameter "database_host".

EDIT: oh and phpinfo(); printes them too. Don't mind the double host and name variables. I tried something.

I made a clean deploy, terminated the ec2 instance and let elastic beanstalk rebuild the ec2 instance.

After that everything worked fine. Maybe i changed some chmods.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM