首页 > CentOS上部署PHP框架CodeIgniter,调用控制器的时候出现404错误如何解决?

CentOS上部署PHP框架CodeIgniter,调用控制器的时候出现404错误如何解决?

CI版本为3.0 dev。

在本地虚拟机CentOS 6.3 和 windows上部署好后,

本机数据库能正确连接
本机controllers能正确调用,通过URL也能正确访问

# /application/config/config.php
$config['base_url'] = '';
$config['index_page'] = 'index.php';
$config['uri_protocol'] = 'AUTO';
$config['url_suffix'] = '';
$config['enable_hooks'] = FALSE;
$config['subclass_prefix'] = 'MY_';

======================================
但是部署到阿里云服务器上后

index.php->
controllers welcome.php->
views welcome_message.php->

首页的welcome_message.PHP依然能正确显示,但是一旦调用自己写的控制器就报错404:

这是我自己写的控制器:

<?php
ini_set("error_reporting",E_ALL ^ E_NOTICE);
class Userinfo extends CI_Controller{
            function userinfo(){
                    parent::__construct();
                    $this->load->database();
                    $this->load->helper('url');
                }
            function index()
            {
                    $id=$_POST['id'];
                    $this->load->model('getmodel');
                    $data = $this->getmodel->getone($id);
                    $output = json_encode($data);
                    $userinfo = '[{"msgtype":"3"}]';
                    $query['getuser_output'] = $userinfo.$output;
                    $this->load->view('welcome_message',$query);
                }
}

/* End of file userinfo.php */
/* Location: ./application/controllers/userinfo.php */

PHP版本是5.3.3 默认配置
apache版本是2.2.15 默认配置
Centos版本是 6.3 x64 关闭了SELINUX

请问大概是哪个环节出了问题?


把这个controller的index设置成default页面呢
404一般是路由错了


把你的 方法:userinfo() 改成:__construct()


弱弱的问一句和pathinfo有关系吗

【热门文章】
【热门文章】