【发布时间】:2014-03-12 22:52:22
【问题描述】:
我是 php 新手,对事物有所了解,但对基本安全概念或服务器管理知之甚少。我最近被黑了(假设来自 mysql 注入),我的文件都被删除了。在尝试恢复运行并尝试正确保护我的脚本后,我遇到了这个问题:
建议我将所有数据库连接用户名/密码等放在单独的 .inc 文件中,在单独的文件夹中(不幸的是,我需要在根目录中的文件夹中)。我做得很好,但也建议我只为包含连接文件的文件夹授予 600 权限。
我的一个数据库连接文件如下所示:
$usersusername = "myusername goes here";
$userspassword = "64bit encrypted password goes here";
$usershostname = "localhost";
$usersdbname = "my database goes here";
我在 index.php 中的包含如下所示:
include_once '/dbauth/myloginscript.inc';
我正在产生错误:
Warning: include_once(/home/mycpaneluser/public_html/dbauth/myloginscript.inc): failed to open stream: Permission denied in /home/mycpaneluser/public_html/index.php on line 60
Warning: include_once(): Failed opening '/home/mycpaneluser/public_html/dbauth/myloginscript.inc' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/myloginscript/public_html/index.php on line 60
我被告知我需要在 http.conf 中包含以某种方式允许权限,但在我到达那一步之前,我是否遵循了正确的程序来保护我的数据库登录信息,还是我错过了标记?任何帮助,将不胜感激。
【问题讨论】:
-
检查
config.inc.php。 -
确保您的
$cfg['Servers'][$i]['user'] = 'yourUsername';和$cfg['Servers'][$i]['password'] = 'yourPassword';。 -
我希望你的文件不是真的
config.inc它应该是config.inc.php