Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php CodeIgniter扩展文件导致http 500_Php_Apache_Codeigniter - Fatal编程技术网

Php CodeIgniter扩展文件导致http 500

Php CodeIgniter扩展文件导致http 500,php,apache,codeigniter,Php,Apache,Codeigniter,如果我扩展到下面的文件或中,只需在autoload.php中自动加载它,我得到的只是http 500,有时是空输出。MYControllerInterface.php位于应用程序/库下 我已将整个目录(递归)修改为0777。我在根目录中创建了一个启用和禁用RewriteEngine的.htaccess 我已经注释掉了MYcontrollerInterface中从{到}的所有内容 我试过删除结尾?> 我已经检查过php配置中是否启用了mod_rewrite。。。这太神秘了 <?php cl

如果我扩展到下面的文件中,只需在autoload.php中自动加载它,我得到的只是http 500,有时是空输出。MYControllerInterface.php位于应用程序/库下

我已将整个目录(递归)修改为0777。我在根目录中创建了一个启用和禁用RewriteEngine的.htaccess

我已经注释掉了MYcontrollerInterface中从{到}的所有内容

我试过删除结尾?>

我已经检查过php配置中是否启用了mod_rewrite。。。这太神秘了

<?php 
class MYcontrollerInterface extends CI_Controller {
    public function __construct() {
        parent::__construct();
        //$this->load->helper('url');
    }   

    function build_page($main_content_view, $data) {
        /*
        $this->load->view('header', $data);    
        //$this->load->view('content', $data);      
        //$this->load->view($main_content_view, $data, true);
        $this->load->view('footer', $data);   
        */      
        echo 'apa';
    }   
}

/* End of file MycontrollerInterface.php */
/* Location: ./application/controllers/MYcontrollerInterface.php */
?>
下面不断重复:

DEBUG - 2012-04-12 13:21:22 --> Global POST and COOKIE data sanitized
DEBUG - 2012-04-12 13:21:22 --> Language Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Loader Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Controller Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Final output sent to browser
DEBUG - 2012-04-12 13:21:22 --> Total execution time: 0.0320
DEBUG - 2012-04-12 13:21:38 --> Config Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Hooks Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Utf8 Class Initialized
DEBUG - 2012-04-12 13:21:38 --> UTF-8 Support Enabled
DEBUG - 2012-04-12 13:21:38 --> URI Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Router Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Output Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Security Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Input Class Initialized

您可以将此文件放入
系统/libraries
文件夹中,然后尝试扩展它。

如果您要扩展控制器(这是一个核心类),它需要进入/application/core

还要检查您的前缀,CI2标准是MY_(在第109行检查您的$config['subclass_prefix'])

更新扩展控制器必须称为MY_控制器(根据加载程序类)

然后你会像这样使用它

class foo extends MY_Controller {
    function __construct() {
        parent::construct();
    }
}

您需要查看
apache
codeigniter
日志,找出问题所在。我在哪里可以找到这些?在mac os xTry上设置xdebug并设置代码的断点。这会让您更好地了解问题所在。Apache日志通常位于
/var/log/apache2/
中。关于CI错误日志:。500错误通常意味着存在php错误/异常。
MYcontrollerInterface.php
应位于
controller
文件夹中。不是Library首先你不应该把任何东西放到系统文件夹中,其次那个文件必须在控制器文件夹中,而不是Library没有任何区别:(如果你想让多个扩展控制器将所有类添加到一个MY_控制器文件中(扩展模型也是如此)
class foo extends MY_Controller {
    function __construct() {
        parent::construct();
    }
}