原文鏈接: http://yunkus.com/dedecms-login-page-goes-blank-solutions/
相信很多站長在轉空間的時候都會發生這樣或者那樣的問題,如常見的用織夢cms做的網站轉到新空間后,網站管理后台無法登錄了,輸入網址竟然顯示空白,什么都沒有了。下面就給大空分享下一些解決織夢后台登錄空間的方法。
方法一:修改include/userlogin.class.php文件
找到include/userlogin.class.php,把這六行代碼注釋掉:
@session_register($this->keepUserIDTag);@session_register($this->keepUserTypeTag);@session_register($this->keepUserChannelTag);@session_register($this->keepUserNameTag);@session_register($this->keepUserPurviewTag);@session_register($this->keepAdminStyleTag);
原因:這個文件里有一個keepUser()函數,它是用session_register來注冊一個session變量,但是在php5.4中已經移除了這個功能。

方法二:文件替換法
找到:include/common.inc.php文件
//error_reporting(E_ALL);error_reporting(E_ALL || ~E_NOTICE);
替換為:
error_reporting(E_ALL);//error_reporting(E_ALL || ~E_NOTICE);
這樣做的目是可以在你訪問網站的時候,在瀏覽器窗口告訴你那里出錯了,或者是那個文件出錯了。你可以根據這些提示,找到之前網站正常運行時備份的文件,替換就可以了。替換完成后記得要把include/common.inc.php改回來
error_reporting(E_ALL);//error_reporting(E_ALL || ~E_NOTICE);
替換為:
//error_reporting(E_ALL);error_reporting(E_ALL || ~E_NOTICE);
方法三:BOM去除法
去除BOM法:BOM 是“Byte Order Mark”的縮寫,用於標記文件的編碼。並不是所有的文本編輯工具都能識別BOM標記.在用記事本之類的程序將文本文件保存為UTF-8格式時,記事本會在文件頭前面加上幾個不可見的字符(EF BB BF),就是所謂的BOM(Byte Order Mark)。
<?php//remove the utf-8 boms//by magicbug at gmail dot comif (isset($_GET['dir'])){ //要去除的文件目錄,無參數則為文件當前目錄。$basedir=$_GET['dir'];}else{$basedir = '.';}$auto = 1;checkdir($basedir);function checkdir($basedir){if ($dh = opendir($basedir)) {while (($file = readdir($dh)) !== false) {if ($file != '.' && $file != '..'){if (!is_dir($basedir."/".$file)) {echo "filename: $basedir/$file ".checkBOM("$basedir/$file")." <br>";}else{$dirname = $basedir."/".$file;checkdir($dirname);}}}closedir($dh);}}function checkBOM ($filename) {global $auto;$contents = file_get_contents($filename);$charset[1] = substr($contents, 0, 1);$charset[2] = substr($contents, 1, 1);$charset[3] = substr($contents, 2, 1);if (ord($charset[1]) == 239 && ord($charset[2]) == 187 &&ord($charset[3]) == 191) {if ($auto == 1) {$rest = substr($contents, 3);rewrite ($filename, $rest);return ("<font color=red>BOM found,automatically removed.</font>");} else {return ("<font color=red>BOM found.</font>");}}else return ("BOM Not Found.");}function rewrite ($filename, $data) {$filenum = fopen($filename, "w");flock($filenum, LOCK_EX);fwrite($filenum, $data);fclose($filenum);}?>
把以上代碼拷貝到txt文件里,保存成.php文件,上傳到網站根目錄,然后用域名+文件名.php訪問就可以了。如果你覺得麻煩,你也可以直接到百度網盤里下載
方法四:PHP.ini設置
思路:既然程序是從一個空間搬到另一個空間的,說明不出什么意外的話程序本身是沒問題的。那么問題還可以出現在哪里呢。空間商!也就是說空間商提供的空間的管理后台里的PHP.ini設置禁止某些不該禁止的功能

圖中有一項叫【輸出緩沖區數據塊設置:】的功能默認是被禁止的,把它改成“啟用”就可以了
