这里是普通文章模块栏目内容页
DedeCMS 5.7不兼容PHP 5.4版本的解决办法

dedecms v5.7安装完成后登录后台出现空白,经过分析代码,发现登录验证的时候用到了这个函数session_register() 

原来我的php版本是5.4版本的,经过一系列的搜寻,发现这个函数在PHP5.4版本中已经被弃用了,已经被删除了。 也就是

这个函数不再可用了。直接注释掉就可以了,不用进行注册就可以声明session。

在include/userlogin.class.php中查找function keepUser(),大概在281行
把keepUser()函数下的@session_register();整段删除
 

另外的解决方法就是在include/userlogin.class.php 中声明一个函数
function session_register()
{
  return true;
}

在PHP 5.4下,登录DedeCMS后台输入用户名和密码后没有提示显示为空白,主要原为是php5.4的版本废除了session_register函数。可以采用如$_SESSION[$this->keepUserIDTag] = $this->userID; 这种方式处理完整代码如下:

解决方法一:

打开 include/userlogin.class.php这个文件,在287行到308行原内容如下:

@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, ‘/’);

至此问题解决。

解决方法二:

找到include文件夹中的userlogin.class.php文件中把所有带有session_register的全部删除即可。

@session_register下的所有语句屏蔽掉

function keepUser()

{

if($this->userID != ” && $this->userType != ”)

{

global $admincachefile,$adminstyle;

if(empty($adminstyle)) $adminstyle = ‘dedecms’;

 代码如下 复制代码

$_SESSION[$this->keepAdminStyleTag] = $adminstyle;

PutCookie(‘DedeUserID’, $this->userID, 3600 * 24, ‘/’);

PutCookie(‘DedeLoginTime’, time(), 3600 * 24, ‘/’);

$this->ReWriteAdminChannel();

return 1;

}

else{….以下省略

相关内容