Where to store database login credentials for a PHP application

后端 未结 5 2295
后悔当初
后悔当初 2020-12-05 10:44

We have a development server and a live server with different database connection details (username, password, etc).

Currently we\'re storing BOTH the database conne

5条回答
  •  我在风中等你
    2020-12-05 11:19

    Another approach would be to setup environment variables on the live and development machine and access them from the code... I don't know much php, but in python that would be:

    import os
    password = os.environ('DB_PASS')
    

    This lets you distribute accounts and passwords as needed to developers and deployed servers. Depending on their permissions on that machine, developers could be prevented from having any access to the live password.

提交回复
热议问题