Workaround for DEDECMS background sign-in blank issue after replacing PHP5.4 or above, php5.4dedecms_php tutorial

Source: Internet
Author: User

Solve the problem of dedecms background login blank after replacing PHP5.4 or above, php5.4dedecms


The PHP version from 5.2.14 to 5.4.15, after the upgrade DEDECMS background but open blank, check the various permissions and files, there is no problem, find out, originally is the PHP version of the function of the problem, it is used Session_ Registers to register a session variable, but this feature has been removed from the php5.4 above
Workaround:
Find include/userlogin.class.php, there is a keepuser () function, it is used Session_register to register a session variable, but in php5.4 has removed this function, see the official website introduction:

If the PHP version you are using will definitely go wrong, but we can modify the following code:
Put @session_register ($this->keepuseridtag); Comment out, and then change to
if (!isset ($_session[$this->keepuseridtag]))
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; 

Re-enter the background login, you can normally jump to the management page.
Because the PHP is not familiar, the internet is generally said to be data/common.inc.php file encoding problem, the code to be changed to no BOM format file save, incredibly did not say is the php5.4 version of the problem
Another method:
Add the following code at the end of the 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]);    }  }  

So php5.4 under Dedecms will be able to use the normal, I hope this article to share the two methods can help you solve the problem smoothly.

http://www.bkjia.com/PHPjc/1063899.html www.bkjia.com true http://www.bkjia.com/PHPjc/1063899.html techarticle To solve the problem of dedecms background login blank after replacing PHP5.4 or above, php5.4dedecms PHP version from 5.2.14 to 5.4.15, after the upgrade DEDECMS background but open blank, check ...

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