duanna2026 2015-04-02 16:22
浏览 139

Laravel环境变量在项目之间发生冲突

I'm experiencing some odd conflict between projects lately.

Basically I have these variables in my .ENV:

DB_HOST DB_DATABASE DB_USERNAME DB_PASSWORD

Let's say I have 2 projects both have the same environment variables but totally different projects/folders.

When one project is accessing the database the 2nd project that attempts to access the database will attempt to connect to the first project's credentials due to the fact the environment variables share the same name.

Both databases are also different. I've tested it by purposely putting them on 2 different mysql servers but that didn't solve it.

Once the first project is done accessing the database, the 2nd project is now working again.

I tested this theory by changing the 2nd project .ENV variables to:

DBHOST DBDATABASE DBUSERNAME DBPASSWORD

And it worked both at the same time. I'd rather not have to make special prefixes (project1-DB-HOST) for every project so they won't try to access each other.

If it matters I'm using Laragon because it's a much simpler setup than Homestead. It's basically just a form of Wamp setup.

Now I don't believe it's a database issue but more so any same named enviornment variable will cause conflicts.

Just a bit confused what's really happening here and how to get around this. Hope someone could shed some light.

Thanks.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
    • ¥20 Java-Oj-桌布的计算
    • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
    • ¥20 有人知道这种图怎么画吗?
    • ¥15 pyqt6如何引用qrc文件加载里面的的资源
    • ¥15 安卓JNI项目使用lua上的问题
    • ¥20 RL+GNN解决人员排班问题时梯度消失
    • ¥60 要数控稳压电源测试数据
    • ¥15 能帮我写下这个编程吗
    • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路