English 中文(简体)
是否拯救了MySQL用户名/密码。 [复制]
原标题:Is saving MySQL username/password in the php.ini file secure? [duplicate]

我愿知道,如果我与MySQL服务器连接,我不必总是把参数放在一起,那么,能否在php.ini档案中节省用户名称、密码、服务器等?

此外,能否以任何一种方法(如:phpinfo()或类似方法)来看待或检索这种信息(取自于php.ini)?

最佳回答

As long as you make sure the ini file is outside the DOCUMENT_ROOT and not world-readable, it s no less secure than any other method.

问题回答

你们不必每次都把这一信息列入参数。 您可在单独档案(dblinkion.php)中界定这一联系,并在档案中包含需要数据库链接的内容。

它是无保障的,因为你可以读到带有实验室方法的无档案:parse_ini_file

我并不认为,由于现场不在“公共”目录之内,因此在Candor.ini档案中保留任何组合会有安全风险。 用户不能查阅这一档案。

You can get ini parameter using "ini_get" php function. You can find more information about this parameter from here: http://php.net/manual/en/function.ini-get.php

如果你在档案中没有延期,就会更有保障,然后用.取。 而且,任何浏览器都可以读到基文,这样就会是多余的。

如上所述,与存放在档案库中相比,基尼档案可能不可靠。 然而,需要考虑的一个问题是,在使用基尼档案时,这种环境实际上对所有PHP代码和网站都是全球性的。 使用ini尼档案可能会影响你希望使用不同用户的其他代码。

总的来说,NOT使用1.ini文档储存密码可能是最佳安全做法,只是因为它现在向任何在服务器上存放PHP档案的人开放。 此外,如果你突然需要提供多个网站或申请不同网站的标识(单独数据库)的话,那也是一条星号。 它对多个数据库最好使用一个标识,但只能用于行政目的的基本用户除外。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签