不少织梦DEDECMS的用户会发现这样的一个问题,就是自己的网站系统迁移到php5.4的环境里就运行不了,出现故障,出现了前台500错误后台直接空白的情况。但是返回到PHP5.2和PHP5.3下又恢复了正常,那到底是什么问题造成了这样的情况发生呢?361模板在网上寻找了不少办法,总结出一下两种有效的处理方法,分下给大家。
原因分析:
DEDECMS代码中使用了PHP5.4中弃用的一些函数,主要如下:
allow_call_time_pass_reference、define_syslog_variables、highlight.bg、register_globals、register_long_arrays、magic_quotes、safe_mode、zend.ze1_compatibility_mode、session.bug_compat42、session.bug_compat_warn、session_register以及 y2k_compliance
其中造成DEDECMS5.7无法正常运行的函数便是session_register。
解决办法:
function session_register() { return true; }
@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(emptyempty($adminstyle)) $adminstyle = 'dedecms'; $_SESSION[$this->keepUserIDTag] = $this->keepUserIDTag; $_SESSION[$this->keepUserIDTag] = $this->userID; $_SESSION[$this->keepUserTypeTag] = $this->keepUserTypeTag; $_SESSION[$this->keepUserTypeTag] = $this->userType; $_SESSION[$this->keepUserChannelTag] = $this->keepUserChannelTag; $_SESSION[$this->keepUserChannelTag] = $this->userChannel; $_SESSION[$this->keepUserNameTag] = $this->keepUserNameTag; $_SESSION[$this->keepUserNameTag] = $this->userName; $_SESSION[$this->keepUserPurviewTag] = $this->keepUserPurviewTag; $_SESSION[$this->keepUserPurviewTag] = $this->userPurview; $_SESSION[$this->keepAdminStyleTag] = $this->keepAdminStyleTag; $_SESSION[$this->keepAdminStyleTag] = $adminstyle; PutCookie('DedeUserID', $this->userID, 3600 * 24, '/'); PutCookie('DedeLoginTime', time(), 3600 * 24, '/');
完成。通过上面的方法一般都可以解决掉 PHP5.4下织梦dedeCMS不能运行 的问题。
以上就是PHP5.4下织梦dedeCMS不能运行的解决办法的全部内容,希望对大家的学习和解决疑问有所帮助,也希望大家多多支持武林网。新闻热点
疑难解答