我是一名PHP新手,對事物有所瞭解,但對基本安全概念或服務器管理知之甚少。我最近被黑客入侵(假設從mysql注入),我的文件全部被刪除。試圖恢復正常運行並嘗試正確保護我的腳本後,我遇到了這個問題:賦予文件夾中的文件的PHP根權限
建議我將所有數據庫連接用戶名/密碼等放在一個單獨的.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'。 – PHPglue
究竟是什麼? – Dustin
確保你的'$ cfg ['Servers'] [$ i] ['user'] ='yourUsername';''和'$ cfg ['Servers'] [$ i] ['password'] ='yourPassword'; '。 – PHPglue