简体   繁体   中英

Moving to new server, now CodeIgniter / Ion_Auth are not working

So I am moving to a new host server. One of my school projects that is in use on the old server must remain up with no downtime, so I am prepping the new server and moving over all the files associated. I've got the virtual host all set up and working, now CodeIgniter and Ion_Auth don't seem to be working.

I am getting the dreadful white screen of death. Here's what I have done so far and in order.

First, CodeIgniter was looking for the Ion_Auth library under 'core/MY_Ion_Auth.php' so after research I found that I needed to change the __autoload() function (application/config/config.php l# 385) FROM

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

TO

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;
        }
    }
} 

And it was a success. My script no longer broke after the autoload. Now, I am still getting a white screen but my log file is showing different errors.

Here's my log 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

Now, the 'undefined variable' is supposed to be undefined. It is in an if statement checking to see if the user is logged in first (which I am not) therefore, this code shouldn't even be running!

Here's the menubar.php if statement:

<?
    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>

All that said, still getting the WSOD and not sure what to do next. I did have to change from mysql to mysqli due to pconnect no longer being supported by PHP5.x. I'm thinking this could have something to do with it but have no idea how to go about fixing it.

Any help will be appreciated!

确保在您的PHP.ini中打开了“ output_buffering”

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM