代码之家  ›  专栏  ›  技术社区  ›  adam

迁移cacke 1.3应用程序登录时出现问题

  •  0
  • adam  · 技术社区  · 7 年前

    我正在尝试将一个旧的CackePHP应用程序(v1.3)从一台主机迁移到另一台主机。 我已经通过phpmyadmin导出了文件1:1和数据库。

    旧主机是一个非常旧的主机,数据库版本(MySQL 5.1.33)没有检查PHP版本,但低于5.6。

    将文件复制到新主机后,登录功能似乎停止工作。此时会出现登录屏幕,但不会在会话中创建登录数据。

    我试图将PHP版本从5.6改为5.4,然后改为5.2,但没有成功,我在网上阅读了一些信息以清除缓存等等,但没有成功。

    该应用程序不是我的,我以前也从未深入研究过CackePHP——因此,如果您能提供任何关于在哪里进一步查看或在此处添加哪些文件的建议,我将不胜感激。

    从我能说的到现在,我包括应用程序_conteoller。这里是php代码。

    <?php
    /**
     * Short description for file.
     *
     * This file is application-wide controller file. You can put all
     * application-wide controller-related methods here.
     *
     * PHP versions 4 and 5
     *
     * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
     * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
     *
     * Licensed under The MIT License
     * Redistributions of files must retain the above copyright notice.
     *
     * @copyright     Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
     * @link          http://cakephp.org CakePHP(tm) Project
     * @package       cake
     * @subpackage    cake.app
     * @since         CakePHP(tm) v 0.2.9
     * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
     */
    
    /**
     * Short description for class.
     *
     * Add your application-wide methods in the class below, your controllers
     * will inherit them.
     *
     * @package       cake
     * @subpackage    cake.app
     */
    class AppController extends Controller {
    
    var $components = array('Acl','Auth','Session');
    var $helpers = array('Form', 'Html', 'Javascript', 'Time','Session');
    
    
        function beforeFilter() {
            parent::beforeFilter();
            $this->disableCache();
    
          var_dump($this->Auth);
    
            $this->set('pageTitle','Transakcje');
            $this->Auth->authorize = 'crud';
            $this->Auth->allowedActions = array(
             'send',
             'register',
             'login',
             'logout',
             'thanks',
             'forgottenpassword',
             'lol',
             'view'
          );
            $this->Auth->redirect('/users/login');
            $this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'login');
            $this->Auth->loginAction = array('admin' => false, 'controller' => 'users', 'action' => 'login');
            $this->Auth->authError = "Brak dostępu do tej części witryny.";
    
          $this->Auth->actionMap['admin_display'] = 'update';
            $this->Auth->actionMap['admin_index'] = 'update';
            $this->Auth->actionMap['admin_edit'] = 'update';
            $this->Auth->actionMap['admin_export'] = 'update';
            $this->Auth->actionMap['addgroup'] = 'upddate';
            $this->Auth->actionMap['admin_activate'] = 'update';
            $this->Auth->actionMap['admin_email'] = 'update';
            $this->Auth->actionMap['admin_delete'] = 'delete';
            $this->Auth->actionMap['index'] = 'read';
            $this->Auth->actionMap['contact'] = 'read';
            $this->Auth->actionMap['changepassword'] = 'read';
            $this->set('username', $this->Auth->user('username'));
    
            if ($this->Auth->user('group_id') == 3) {
                $this->set('is_admin',true);
            }
            else {
                $this->set('is_admin',false);
            }
            define('HEADERS','From: webmaster@example.com' . "\r\n" .
                'Reply-To: webmaster@example.com' . "\r\n" .
                'X-Mailer: PHP/' . phpversion());
    
        }
    }
    ?>
    

    我在尝试登录后丢弃了Auth对象,从中可以看出登录信息不存在

    object(AuthComponent)#38 (26) {
      ["_loggedIn"]=>
      bool(false)
      ["components"]=>
      array(2) {
        [0]=>
        string(7) "Session"
        [1]=>
        string(14) "RequestHandler"
      }
      ["authenticate"]=>
      NULL
      ["authorize"]=>
      bool(false)
      ["ajaxLogin"]=>
      NULL
      ["flashElement"]=>
      string(7) "default"
      ["userModel"]=>
      string(4) "User"
      ["userScope"]=>
      array(0) {
      }
      ["fields"]=>
      array(2) {
        ["username"]=>
        string(8) "username"
        ["password"]=>
        string(8) "password"
      }
      ["sessionKey"]=>
      NULL
      ["actionPath"]=>
      NULL
      ["loginAction"]=>
      NULL
      ["loginRedirect"]=>
      NULL
      ["logoutRedirect"]=>
      NULL
      ["object"]=>
      NULL
      ["loginError"]=>
      NULL
      ["authError"]=>
      NULL
      ["autoRedirect"]=>
      bool(true)
      ["allowedActions"]=>
      array(0) {
      }
      ["actionMap"]=>
      array(18) {
        ["index"]=>
        string(4) "read"
        ["add"]=>
        string(6) "create"
        ["edit"]=>
        string(6) "update"
        ["view"]=>
        string(4) "read"
        ["remove"]=>
        string(6) "delete"
        ["create"]=>
        string(6) "create"
        ["read"]=>
        string(4) "read"
        ["update"]=>
        string(6) "update"
        ["delete"]=>
        string(6) "delete"
        ["admin_index"]=>
        string(4) "read"
        ["admin_add"]=>
        string(6) "create"
        ["admin_edit"]=>
        string(6) "update"
        ["admin_view"]=>
        string(4) "read"
        ["admin_remove"]=>
        string(6) "delete"
        ["admin_create"]=>
        string(6) "create"
        ["admin_read"]=>
        string(4) "read"
        ["admin_update"]=>
        string(6) "update"
        ["admin_delete"]=>
        string(6) "delete"
      }
      ["data"]=>
      array(0) {
      }
      ["params"]=>
      array(9) {
        ["controller"]=>
        string(5) "users"
        ["action"]=>
        &string(10) "admin_view"
        ["named"]=>
        array(0) {
        }
        ["pass"]=>
        array(1) {
          [0]=>
          string(2) "88"
        }
        ["prefix"]=>
        string(5) "admin"
        ["admin"]=>
        bool(true)
        ["plugin"]=>
        NULL
        ["form"]=>
        array(0) {
        }
        ["url"]=>
        array(1) {
          ["url"]=>
          string(19) "admin/users/view/88"
        }
      }
      ["_methods"]=>
      array(14) {
        [0]=>
        string(9) "admin_add"
        [1]=>
        string(10) "admin_edit"
        [2]=>
        string(12) "admin_delete"
        [3]=>
        string(5) "login"
        [4]=>
        string(6) "logout"
        [5]=>
        string(11) "admin_index"
        [6]=>
        string(10) "admin_view"
        [7]=>
        string(8) "register"
        [8]=>
        string(6) "thanks"
        [9]=>
        string(14) "admin_activate"
        [10]=>
        string(17) "forgottenpassword"
        [11]=>
        string(14) "changepassword"
        [12]=>
        string(7) "contact"
        [13]=>
        string(11) "admin_email"
      }
      ["enabled"]=>
      bool(true)
      ["Session"]=>
      &object(SessionComponent)#39 (15) {
        ["__active"]=>
        bool(true)
        ["__bare"]=>
        int(0)
        ["valid"]=>
        bool(false)
        ["error"]=>
        bool(false)
        ["_userAgent"]=>
        string(32) "926c6c491cb815708e7614617a013876"
        ["path"]=>
        string(1) "/"
        ["lastError"]=>
        NULL
        ["security"]=>
        string(6) "medium"
        ["time"]=>
        int(1530884153)
        ["sessionTime"]=>
        int(1530896153)
        ["watchKeys"]=>
        array(0) {
        }
        ["id"]=>
        NULL
        ["_started"]=>
        bool(false)
        ["host"]=>
        string(30) "i removed the address from here"
        ["enabled"]=>
        bool(true)
      }
      ["RequestHandler"]=>
      &object(RequestHandlerComponent)#40 (10) {
        ["ajaxLayout"]=>
        string(4) "ajax"
        ["enabled"]=>
        bool(true)
        ["__responseTypeSet"]=>
        NULL
        ["params"]=>
        array(0) {
        }
        ["__requestContent"]=>
        array(23) {
          ["javascript"]=>
          string(15) "text/javascript"
          ["js"]=>
          string(15) "text/javascript"
          ["json"]=>
          string(16) "application/json"
          ["css"]=>
          string(8) "text/css"
          ["html"]=>
          array(2) {
            [0]=>
            string(9) "text/html"
            [1]=>
            string(3) "*/*"
          }
          ["text"]=>
          string(10) "text/plain"
          ["txt"]=>
          string(10) "text/plain"
          ["csv"]=>
          array(2) {
            [0]=>
            string(24) "application/vnd.ms-excel"
            [1]=>
            string(10) "text/plain"
          }
          ["form"]=>
          string(33) "application/x-www-form-urlencoded"
          ["file"]=>
          string(19) "multipart/form-data"
          ["xhtml"]=>
          array(3) {
            [0]=>
            string(21) "application/xhtml+xml"
            [1]=>
            string(17) "application/xhtml"
            [2]=>
            string(10) "text/xhtml"
          }
          ["xhtml-mobile"]=>
          string(29) "application/vnd.wap.xhtml+xml"
          ["xml"]=>
          array(2) {
            [0]=>
            string(15) "application/xml"
            [1]=>
            string(8) "text/xml"
          }
          ["rss"]=>
          string(19) "application/rss+xml"
          ["atom"]=>
          string(20) "application/atom+xml"
          ["amf"]=>
          string(17) "application/x-amf"
          ["wap"]=>
          array(3) {
            [0]=>
            string(16) "text/vnd.wap.wml"
            [1]=>
            string(22) "text/vnd.wap.wmlscript"
            [2]=>
            string(18) "image/vnd.wap.wbmp"
          }
          ["wml"]=>
          string(16) "text/vnd.wap.wml"
          ["wmlscript"]=>
          string(22) "text/vnd.wap.wmlscript"
          ["wbmp"]=>
          string(18) "image/vnd.wap.wbmp"
          ["pdf"]=>
          string(15) "application/pdf"
          ["zip"]=>
          string(17) "application/x-zip"
          ["tar"]=>
          string(17) "application/x-tar"
        }
        ["mobileUA"]=>
        array(22) {
          [0]=>
          string(7) "Android"
          [1]=>
          string(7) "AvantGo"
          [2]=>
          string(10) "BlackBerry"
          [3]=>
          string(6) "DoCoMo"
          [4]=>
          string(4) "iPod"
          [5]=>
          string(6) "iPhone"
          [6]=>
          string(4) "J2ME"
          [7]=>
          string(4) "MIDP"
          [8]=>
          string(8) "NetFront"
          [9]=>
          string(5) "Nokia"
          [10]=>
          string(10) "Opera Mini"
          [11]=>
          string(6) "PalmOS"
          [12]=>
          string(10) "PalmSource"
          [13]=>
          string(9) "portalmmm"
          [14]=>
          string(7) "Plucker"
          [15]=>
          string(14) "ReqwirelessWeb"
          [16]=>
          string(12) "SonyEricsson"
          [17]=>
          string(7) "Symbian"
          [18]=>
          string(11) "UP\.Browser"
          [19]=>
          string(5) "webOS"
          [20]=>
          string(10) "Windows CE"
          [21]=>
          string(5) "Xiino"
        }
        ["__acceptTypes"]=>
        array(6) {
          [0]=>
          string(9) "text/html"
          [1]=>
          string(21) "application/xhtml+xml"
          [2]=>
          string(15) "application/xml"
          [3]=>
          string(10) "image/webp"
          [4]=>
          string(10) "image/apng"
          [5]=>
          string(3) "*/*"
        }
        ["__renderType"]=>
        NULL
        ["ext"]=>
        NULL
        ["__typesInitialized"]=>
        bool(false)
      }
    }
    

    我已经关闭了CackePHP中的调试选项,但没有多大帮助。我可以通过私人信息发送应用程序链接。

    0 回复  |  直到 7 年前
    推荐文章