您当前的位置: 主页 > 优化教程
本文实例讲述了DEDECMS在PHP5.4不能正常运行的解决方法。分享给大家供大家参考。具体分析如下:
 
PHP5.4是公开发行的PHP程式最新版本,其执行速度和内存占用等相比PHP5.3而言有10%~30%的性能提升,所以笔者也一直想在实际环境中试运行PHP5.4(PHP5.4目前最新的版本为5.4.9)。
 
棘手的是与PHP5.2升级到PHP5.3有所不同的是,从5.3到5.4之间似乎变化不少,这也造成了笔者在将DEDECMS系统迁移到PHP5.4.x平台的时候出现了前台500错误后台直接空白的情况,当时也没有深究便换回PHP5.3了。
 
最近仔细查了下相关资料,发现主要是因为目前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。
 
网上实测有效的方法有如下两种:
 
第一种方法申明将此函数废弃,在include/userlogin.class.php中加入如下代码:
 
代码如下:function session_register()
{
return true;
}
第二种方法是该该页中的函数代码替换,被替换代码大致在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(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, '/');
 
希望本文所述对大家的dedecms建站有所帮助。
 

关键词:DEDECMS,在,PHP5.4,不能,正常,运,行的,解决    标签:
    更多资讯请收藏关注 网站模板(www.1yc.cn)

dedecms 栏目目录用首字母生成的方法修改dede/catalog.add.php文件 85行 $topty... 2021-07-27
{dede:field name='softlinks'/}下载页织梦标签修改织梦Dedecms的软件模型中,{dede:field name=so... 2021-07-30
织梦dedecms dede:arclist输出取消换行符织梦模板 在使用dede:arclist输出文档时,会自动有换行符,想... 2021-07-22
织梦后台还原数据库的时其它数据表不影响怎么处理呢织梦dedecms程序建站越来越方便了,现在模板和数据库都是集成在一个... 2021-08-14
Dedecms提示ereg_replace() is deprecated错误织梦Dedecms提示 ereg_replace() is depre... 2021-08-09
如何让Dedecms留言板自动邮件通知管理员网站中使用较广泛的一种与用户沟通、交流的方式。一般都是通过留言板,留言... 2021-08-14
在 DedeCMS 列表页中怎样得到文章总数的要领在做dedecms 织梦模板 时,尤其在列表页我们常常想在页面内插手文... 2021-07-22
DEDE设置根据文章标题自动获取tag的方法DEDE设置根据文章标题自动获取tag的方法: 修改:\dede\ac... 2021-07-27
百度编辑器ueditor代码高亮效果实现方法相信很多朋友在使用ueditor,同样地,我之前也一直使用uedito... 2021-07-22
织梦选择特定的栏目搜索技巧针对企业网站,特别是很多产品类别的企业网站,需要对栏目类别进行选项搜索... 2021-07-27
在织梦列表标题、tag标签列表加序号(第x页)默认的织梦DedeCMS列表标题以及tag标签列表是没有序号显示的(也... 2021-07-30
织梦二级当前栏目高亮的解决方法首先,修改 include\taglib\channelartlist... 2021-07-22
织梦tag显示每个tag相应的文章数量有些时候我们想实现类似于wordpress那样的tag,就是在显示ta... 2021-07-30
织梦DEDECMS网站添加随机文章在织梦网站中添加随机文章的代码其实很简单,在DEDE默认文章内容页模板... 2021-07-27
织梦dedecms会员中心调用出需要的循环文档实现的办法比较简单,一句JS搞定:document.getElemen... 2021-07-27
如何修改DEDE后台的标题-织梦内容管理系统dede/template/index2.htm 这个后台页面中。修改... 2021-07-30

线
咨询热线:
135-0038-3336
在线客服:
点击这里给我发消息
微信交流:
公司官网: www.1yc.cn