php - 转移到新服务器,现在 CodeIgniter/Ion_Auth 无法工作

标签 php mysql codeigniter mysqli ion-auth

所以我要转移到新的主机服务器。我在旧服务器上使用的一个学校项目必须保持正常运行,不得停机,因此我正在准备新服务器并移动所有关联的文件。我已将虚拟主机设置完毕并正常工作,但现在 CodeIgniter 和 Ion_Auth 似乎无法正常工作。

我遇到了可怕的白屏死机。这是我迄今为止按顺序所做的事情。

首先,CodeIgniter 正在“core/MY_Ion_Auth.php”下寻找 Ion_Auth 库,因此经过研究,我发现我需要更改 __autoload() 函数 (application/config/config.php l# 385) FROM

function __autoload($class)
{
    if(strpos($class, 'CI_') !== 0)
    {
        @include_once( APPPATH . 'core/'. $class . EXT );
    }
}    

function __autoload($class)
{
    if (strpos($class, 'CI_') !== 0)
    {
        if (file_exists($file = APPPATH . 'core/' . $class . EXT))
        {
            include $file;
        }

        elseif (file_exists($file = APPPATH . 'libraries/' . $class . EXT))
        {
            include $file;
        }
    }
} 

而且它很成功。自动加载后我的脚本不再中断。现在,我仍然看到白屏,但我的日志文件显示不同的错误。

这是我的日志文件:

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>
ERROR - 2015-01-29 11:55:15 --> Severity: Notice  --> Undefined variable: user /var/www/CIS411-GIS_Conference/application/views/templates/menubar.php 36
ERROR - 2015-01-29 11:55:15 --> Severity: Notice  --> Trying to get property of non-object /var/www/CIS411-GIS_Conference/application/views/templates/menubar.php 36
ERROR - 2015-01-29 11:55:15 --> Severity: Notice  --> Undefined variable: user /var/www/CIS411-GIS_Conference/application/views/templates/menubar.php 39
ERROR - 2015-01-29 11:55:15 --> Severity: Notice  --> Trying to get property of non-object /var/www/CIS411-GIS_Conference/application/views/templates/menubar.php 39

现在,“ undefined variable ”应该是未定义的。它在 if 语句中检查用户是否首先登录(我没有),因此,该代码甚至不应该运行!

这是 menubar.php if 语句:

<?
    if ($this->ion_auth->logged_in()) {
        // Get users info
        $user = $this->ion_auth->user()->row();
        // Display account links
?>
    <li class="dropdown">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><?=$user->email?> <span class="caret"></span></a>
        <ul class="dropdown-menu" role="menu">
          <li <? if(is_active('auth/dashboard')): ?>class="active"<? endif; ?>><a href="<?= site_url('auth/dashboard') ?>">Dashboard</a></li>
          <li <? if(is_active('auth/edit_user')): ?>class="active"<? endif; ?>><a href="<?= site_url('auth/edit_user/'.$user->id) ?>">Account Settings</a></li>
          <li class="divider"></li>
          <li><a href="<?= site_url('auth/logout') ?>">Logout</a></li>
        </ul>
    </li>

尽管如此,仍然收到 WSOD 并且不确定下一步该做什么。 由于 PHP5.x 不再支持 pconnect,我确实必须从 mysql 更改为 mysqli。我认为这可能与此有关,但不知道如何修复它。

任何帮助将不胜感激!

最佳答案

确保 PHP.ini 中的“output_buffering”已打开

关于php - 转移到新服务器,现在 CodeIgniter/Ion_Auth 无法工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28220924/

相关文章:

php - 由 php 调用时 curl 未正确执行

php - MySQL 没有找到只对应一个用户名的行,但它确实存在?

c# - 如何从 MVC Razor 中的两个表返回带有外部连接的 View

MySQL:如何从命令行传递参数?

javascript - 如何将折线保存到数据库中?使用谷歌地图和JS?

php - SQL 更新查询无法正确处理 php 数据

php - MySQL 语法区域和 2 个下拉菜单之间的验证

php - 比较不同表中两列的 SUM()?

jquery - 返回同一页面的 CodeIgniter AJAX 错误

php - 如何使用 PHP 和 MySQL 自动填写 HTML 表单?