DEDECMS后台无法登录,所有解决方案
在本地调试好的dedecms上传到服务器后,后台无法登录,提示登录成功之后,又跳回登录页。在网上查找了好多解决办法,都没有找到适合自己的方法,功夫不负有心人。自己通过对比服务器配置终于找到了答案。下面是我从网上总结的解决方案和我自己的解决方法。我的服务器配置php 5.2.5+mysql+apache配置文件正确的情况下用以下方法。方法一:php 5.4没有session_register方法,所以需要在include/userlogin.class.php中加入以下代码functionsession_register(){ $args= func_get_args(); foreach($argsas$key){ $_SESSION[$key]=$GLOBALS[$key]; }}方法二:由于php 5.4没有session_register方法。找开include/userlogin.class.php文件,查找以下内容:@session_register($this->keepUserIDTag);$_SESSION[$this->keepUserIDTag] = $this->userID;@session_register($this->keepUserTypeTag);$_SESSION[$this->keepUserTypeTag] = $this->userType;@session_register($this->keepUserChannelTag);$_SESSION[$this->keepUserChannelTag] = $this->userChannel;@session_register($this->keepUserNameTag);$_SESSION[$this->keepUserNameTag] = $this->userName;@session_register($this->keepUserPurviewTag);$_SESSION[$this->keepUserPurviewTag] = $this->userPurview;@session_register($this->keepAdminStyleTag);$_SESSION[$this->keepAdminStyleTag] = $adminstyle;PutCookie(‘DedeUserID’, $this->userID, 3600 * 24, ‘/’);PutCookie(‘DedeLoginTime’, time(), 3600 * 24, ‘/’);
替换成
global $admincachefile,$adminstyle;if(empty($adminstyle)) $adminstyle = ‘dedecms’;//@session_register($this->keepUserIDTag);$_SESSION[$this->keepUserIDTag] = $this->keepUserIDTag;$_SESSION[$this->keepUserIDTag] = $this->userID;//@session_register($this->keepUserTypeTag);$_SESSION[$this->keepUserTypeTag] = $this->keepUserTypeTag;$_SESSION[$this->keepUserTypeTag] = $this->userType;// @session_register($this->keepUserChannelTag);$_SESSION[$this->keepUserChannelTag] = $this->keepUserChannelTag;$_SESSION[$this->keepUserChannelTag] = $this->userChannel;//@session_register($this->keepUserNameTag);$_SESSION[$this->keepUserNameTag] = $this->keepUserNameTag;$_SESSION[$this->keepUserNameTag] = $this->userName;//@session_register($this->keepUserPurviewTag);$_SESSION[$this->keepUserPurviewTag] = $this->keepUserPurviewTag;$_SESSION[$this->keepUserPurviewTag] = $this->userPurview;// @session_register($this->keepAdminStyleTag);$_SESSION[$this->keepAdminStyleTag] = $this->keepAdminStyleTag;$_SESSION[$this->keepAdminStyleTag] = $adminstyle;PutCookie(‘DedeUserID’, $this->userID, 3600 * 24, ‘/’);PutCookie(‘DedeLoginTime’, time(), 3600 * 24, ‘/’);方法三:文件夹权限问题验证码无法显示和自动登出的原因是因为date文件夹和date下面的sessions文件夹的写入权限没有!Sessions是记录(传送)登入信息的文件夹, 它无法生成文件, 自然就无法登陆而跳转回来。
解决办法如下:修改date和date下面的sessions文件夹的权限,(可以尝试在FLASHFXP上修改,但可能会造成失败)所以建议直接在主机的控制面板里面修改date和sessions的权限为777(writen)方法四:重新安装dedecms然后用数据库备份还原数据库方法五(本人所用):php.ini配置文件中session.bug_compat_42 = 1session.bug_compat_warn = 1http://hiphotos.baidu.com/exp/pic/item/9c57e3faaf51f3deb836e83497eef01f3b29799e.jpg
这是php4.3.0以后才有的安全设置。出于安全的考虑php不建议你打开register_globals开关但若关闭了register_globals(默认)时,session变量将不被自动转换成全局变量此时传统的session变量注册方式session_register就失去意义了(session_register是把一个全局变量注册成session变量),因为访问session变量需要使用$_SESSION数组。因此只需直接操作$_SESSION数组就可以了,而无须再用session_register注册了。以免产生混乱开关session.bug_compat_42 和 session.bug_compat_warn 就是为了检查此类情况而设置的
页:
[1]