dri8163 2015-06-23 12:42
浏览 100
已采纳

yaml,xml或注释存储相关信息的安全性如何? [关闭]

I usually code in PHP and I have seen in many applications some config files with a bunch of constants with relevant information, such as passwords, e-mail addresses, ip's of servers or other machines... hidden in the tree folder (or not so much hidden).

A good example of this is the wp-config.php file of Wordpress.

I wonder if is safer to keep this information in other file formats or even in a Database.

Is there any advantage on using yaml, xml or annotations like some frameworks (like Symfony) do?

  • 写回答

2条回答 默认 最新

  • doushi1974 2015-06-23 13:21
    关注

    Regarding the safety: what mario and PiranhaGeorge said (it depends on the location, the locatiion shouldn't be accessible by a browser)

    Regarding the use of config files: keep in mind that you absolutely need a few informations first, before you can access more complex storage facilities. For example you need to have db access parameters or decrypt informations for crypted files. There are a few settings that have to be known at the start of the application and can't (easily) be changed during the runtime. Another example other than db access parameter could be include paths to plugin directories. These informations have to be changeable without starting the application first.

    Ideally you want a format that is easily understandable by both the machine (for example the PHP interpreter) and the admin. The machine needs to spend as little time as possible in loading the configuration, the admin needs a way to change the application parameters in a simple way (think SSH and vi or other bash editors on a smart phone, if there is an emergency), for example if there is a need to switch between production and testing databases.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line