Solution to the blank background login problem of Dedecms after PHP5.4 and later versions, php5.4decms _ PHP Tutorial

Source: Internet
Author: User
Php5.4decms is used to solve the problem of blank background login in Dedecms after PHP5.4 and later versions. To solve the problem of blank background login in Dedecms after PHP5.4 and later versions, php5.4dedecms upgraded PHP from 5.2.14 to 5.4.15. after the upgrade, the background of dedecms is blank, check the solution to the blank background login problem of Dedecms after changing PHP5.4 or above, php5.4dedecms

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, 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.

The supervisor upgraded the PHP version from 5.2.14 to 5.4.15. after the upgrade, the background of dedecms is blank and checked...

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.