所以我试图解决为什么CodeIgniter不会显示任何输出(除了404等).我已经检查了从错误登录php和apache和codeigniter到模块重写的所有内容.一切似乎配置得很好.
我开始深入研究CodeIgniter核心文件,并注意到它在下面的行上崩溃,试图实例化所请求的控制器类:
$class = $RTR->fetch_class();
$method = $RTR->fetch_method();
echo 'looking for class: ' . $class . '<br/>';
if(class_exists($class) == false) {
)
{
echo 'class does not exist: ' . $class;
show_404("{$class}/{$method}");
}
}
/*
* ------------------------------------------------------
* Is there a "pre_controller" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('pre_controller');
echo '<br/>after precontroller';
/*
* ------------------------------------------------------
* Instantiate the requested controller
* ------------------------------------------------------
*/
// Mark a start point so we can benchmark the controller
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start');
echo '<br/>before class init: ' . $class;
$CI = new $class();
echo '<br/>after class init';
Run Code Online (Sandbox Code Playgroud)
这是在/core/CodeIgniter.php文件中.这是输出:
CodeIgniter.php
looking for class: servicecontroller
after precontroller
before class init: servicecontroller
Run Code Online (Sandbox Code Playgroud)
基本上它告诉我它可以找到servicecontroller类,但是当它试图实例化它时,它会崩溃.启用了php错误日志记录,并且启用了display_errors.如果我在这附近的任何地方强制发生php错误,我会在页面上看到它,但不是这个.有谁知道为什么它不能通过这条线?
servicecontroller.php安排如下:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class servicecontroller extends CI_Controller {
}
Run Code Online (Sandbox Code Playgroud)
好的,这个问题的根源是使用mysql_connect连接到数据库的错误.由于某种原因,它不会产生任何错误,也不会"或死("错误......");做任何事情.这是因为我们在服务器上使用php 5.4,而且似乎不再支持mysql_connect ,除非你安装了mysqlnd.解决方案是将我们的数据库驱动程序切换为'mysqli',CodeIgniter幸运地有一个驱动程序,然后安装php5-mysql:apt-get install php5-mysql希望这可以帮助其他人.
在核心系统文件夹中无需执行任何操作。
| 归档时间: |
|
| 查看次数: |
4396 次 |
| 最近记录: |