Solution to the blank background login problem of Dedecms after PHP5.4 and later versions

Source: Internet
Author: User
Why is there a blank background login in Dedecms after PHP5.4 or later? This article will give you a detailed analysis to find out the real reasons and solutions.

Why is there a blank background login in Dedecms after PHP5.4 or later? This article will give you a detailed analysis to find out the real reasons and solutions.

Upgrade the PHP version from 5.2.14 to 5.4.15. After the upgrade, the dedecms background opens a blank space and checks various permissions and files. There is no problem. Find them ,, it turns out to be a PHP version function. It uses session_register to register a session variable, but this function has been removed from php5.4 and later versions.
Solution:
Find include/userlogin. class. php, which contains a keepuser () function, which uses session_register to register a session variable, but this function has been removed in php5.4. For details, see the official website:

If this php version is used, errors will occur, but we can modify the code:
Comment out @ session_register ($ this-> keepUserIDTag), and change it
If (! Isset ($ _ SESSION [$ this-> keepUserIDTag])
There are a total of six, all changed to the following:

If (! Isset ($ _ SESSION [$ this-> keepUserIDTag]) // @ session_register ($ this-> keepUserIDTag ); $ _ SESSION [$ this-> keepUserIDTag] = $ this-> userID; if (! Isset ($ _ SESSION [$ this-> keepUserTypeTag]) // @ session_register ($ this-> keepUserTypeTag ); $ _ SESSION [$ this-> keepUserTypeTag] = $ this-> userType; if (! Isset ($ _ SESSION [$ this-> keepUserChannelTag]) // @ session_register ($ this-> keepUserChannelTag ); $ _ SESSION [$ this-> keepUserChannelTag] = $ this-> userChannel; if (! Isset ($ _ SESSION [$ this-> keepUserNameTag]) // @ session_register ($ this-> keepUserNameTag ); $ _ SESSION [$ this-> keepUserNameTag] = $ this-> userName; if (! Isset ($ _ SESSION [$ this-> keepUserPurviewTag]) // @ session_register ($ this-> keepUserPurviewTag ); $ _ SESSION [$ this-> keepUserPurviewTag] = $ this-> userPurview; if (! Isset ($ _ SESSION [$ this-> keepAdminStyleTag]) // @ session_register ($ this-> keepAdminStyleTag); $ _ SESSION [$ this-> keepAdminStyleTag] = $ adminstyle;

Log on to the background again to go to the Management page.
Because I am not familiar with PHP, it is generally said on the Internet that the data/common. inc. PHP file encoding problem, the encoding should be changed to a non-BOM format file to save, It is not said that it is a problem with php5.4
Another method:
Add the following code at the end of include/helpers/util. helper. php:

Function fix_session_register () {function session_register () {$ args = func_get_args (); foreach ($ args as $ key) {$ _ SESSION [$ key] = $ GLOBALS [$ key] ;}} function session_is_registered ($ key) {return isset ($ _ SESSION [$ key]);} function session_unregister ($ key) {unset ($ _ SESSION [$ key]) ;}} if (! Function_exists ('session _ register ') fix_session_register ();

In this way, dedecms can be used normally under php5.4. We hope the two methods shared in this article can help you solve the problem smoothly.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.