[英]Moving to new server, now CodeIgniter / Ion_Auth are not working
因此,我将移至新的主机服务器。 旧服务器上正在使用的我的一个学校项目必须保持正常运行,而不会造成停机,因此,我正在准备新服务器并移动所有关联的文件。 我已经设置好了虚拟主机,并且可以正常工作,现在CodeIgniter和Ion_Auth似乎不起作用。
我正在看到可怕的死亡白屏。 到目前为止,这是我已经按顺序完成的工作。
首先,CodeIgniter在“ core / MY_Ion_Auth.php”下寻找Ion_Auth库,因此在研究之后,我发现需要更改__autoload()函数(application / config / config.php l#385),
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
现在,“未定义的变量”应该是未定义的。 它是在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不再支持pconnect,我确实必须从mysql更改为mysqli。 我认为这可能与它有关,但不知道如何解决它。
任何帮助将不胜感激!
确保在您的PHP.ini中打开了“ output_buffering”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.