Php Codeigniter URI问题…不存在URI。默认控制器集

Php Codeigniter URI问题…不存在URI。默认控制器集,php,codeigniter-3,Php,Codeigniter 3,我的codeigniter应用程序部署在Amazon上的EC2实例上时出现问题 $config['base_url'] = 'http://XX.XX.XXX.107/'; $config['index_page'] = 'index.php'; 这是我的route.php(没有任何特定规则) 实际上,如果我正确地调用它,则显示我的第一页(它加载我的默认控制器Home.php并显示Home.php视图)。 但如果我调用,例如,它不会在表单视图中显示符号,而是再次显示主视图 我启用了日志,这就是

我的codeigniter应用程序部署在Amazon上的EC2实例上时出现问题

$config['base_url'] = 'http://XX.XX.XXX.107/';
$config['index_page'] = 'index.php';
这是我的route.php(没有任何特定规则)

实际上,如果我正确地调用它,则显示我的第一页(它加载我的默认控制器Home.php并显示Home.php视图)。 但如果我调用,例如,它不会在表单视图中显示符号,而是再次显示主视图

我启用了日志,这就是我得到的

INFO - 2016-08-08 15:43:25 --> Config Class Initialized
INFO - 2016-08-08 15:43:25 --> Hooks Class Initialized
DEBUG - 2016-08-08 15:43:25 --> UTF-8 Support Enabled
INFO - 2016-08-08 15:43:25 --> Utf8 Class Initialized
INFO - 2016-08-08 15:43:25 --> URI Class Initialized
DEBUG - 2016-08-08 15:43:25 --> No URI present. Default controller set.
INFO - 2016-08-08 15:43:25 --> Router Class Initialized
INFO - 2016-08-08 15:43:25 --> Output Class Initialized
INFO - 2016-08-08 15:43:25 --> Security Class Initialized
DEBUG - 2016-08-08 15:43:25 --> Global POST, GET and COOKIE data sanitized
INFO - 2016-08-08 15:43:25 --> Input Class Initialized
INFO - 2016-08-08 15:43:25 --> Language Class Initialized
INFO - 2016-08-08 15:43:25 --> Loader Class Initialized
INFO - 2016-08-08 15:43:25 --> Helper loaded: file_helper
INFO - 2016-08-08 15:43:25 --> Helper loaded: form_helper
INFO - 2016-08-08 15:43:25 --> Helper loaded: url_helper
INFO - 2016-08-08 15:43:25 --> Database Driver Class Initialized
INFO - 2016-08-08 15:43:25 --> Database Driver Class Initialized
INFO - 2016-08-08 15:43:25 --> Session: Class initialized using 'files' driver.
INFO - 2016-08-08 15:43:25 --> XML-RPC Class Initialized
INFO - 2016-08-08 15:43:25 --> Controller Class Initialized
INFO - 2016-08-08 15:43:25 --> Model Class Initialized
INFO - 2016-08-08 15:43:25 --> Model Class Initialized
INFO - 2016-08-08 15:43:25 --> Model Class Initialized
INFO - 2016-08-08 15:43:25 --> Model Class Initialized
INFO - 2016-08-08 15:43:25 --> Form Validation Class Initialized
DEBUG - 2016-08-08 15:43:25 --> Session class already loaded. Second attempt ignored.
INFO - 2016-08-08 15:43:25 --> File loaded: /var/www/core_ci/application/views/header.php
INFO - 2016-08-08 15:43:25 --> File loaded: /var/www/core_ci/application/views/home.php
INFO - 2016-08-08 15:43:25 --> File loaded: /var/www/core_ci/application/views/footer.php
INFO - 2016-08-08 15:43:25 --> Final output sent to browser
DEBUG - 2016-08-08 15:43:25 --> Total execution time: 0.1061
正如您在日志中看到的,我得到了调试-2016-08-08 15:43:25-->没有URI。默认控制器设置,即使我正在调用此url

以下是有关我的服务器的一些数据:

PHP Version 5.5.35
System  Linux ip-xx-x-x-xxx 4.4.8-20.46.amzn1.x86_64 #1 SMP Wed Apr 27 19:28:52 UTC 2016 x86_64
Build Date  May 2 2016 23:29:10
Server API  FPM/FastCGI
这里是vhost Apache文件:

<VirtualHost *:80>

  # Leave this alone. This setting tells Apache that
  # this vhost should be used as the default if nothing
  # more appropriate is available.

  ServerName default:80

  # REQUIRED. Set this to the directory you want to use for
  # your “default” site files.

  DocumentRoot /var/www/html

  # Optional. Uncomment this and set it to your admin email
  # address, if you have one. If there is a server error,
  # this is the address that Apache will show to users.

  #ServerAdmin you@example.com

  # Optional. Uncomment this if you want to specify
  # a different error log file than the default. You will
  # need to create the error file first.

  #ErrorLog /var/www/vhosts/logs/error_log

  <Directory /var/www/html>
    AllowOverride All
  </Directory>

  ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1
  DirectoryIndex /index.php index.php
</VirtualHost>

#别管这个了。此设置告诉Apache
#如果没有,则应将此vhost用作默认值
#更合适的是可用的。
服务器名默认值:80
#必需的。将此设置为要用于的目录
#您的“默认”站点文件。
DocumentRoot/var/www/html
#可选。取消对此的注释并将其设置为您的管理员电子邮件
#地址,如果你有。如果出现服务器错误,
#这是Apache将向用户显示的地址。
#服务器管理员you@example.com
#可选。如果要指定,请取消对此的注释
#与默认错误日志文件不同的错误日志文件。你会
#需要先创建错误文件。
#ErrorLog/var/www/vhosts/logs/error\u log
允许超越所有
ProxyPassMatch^/(.\.php(/.*)$fcgi://127.0.0.1:9000/var/www/html/$1
DirectoryIndex/index.php index.php
有没有人能告诉我失败的地方

提前谢谢

已更新

Home.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller {
        public function __construct()
        {
                parent::__construct();
                $this->load->model('Home_model');
                $this->load->model('Users_model');
                $this->load->model('Credit_model');
                $this->load->library('form_validation');
                $this->load->library('language');
                $this->load->library('alerts');
                $this->load->library('session');
                $this->load->helper('url');
//        $this->load->helper('captcha');
        }

public function test()
{
        print_r('my test method');
}

经过大量研究并查看httpd服务日志,我找到了解决方案

在vhost文件中,我替换了这行代码

ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1
用这些

<FilesMatch \.php$>
        # 2.4.10+ can proxy to unix socket
        # SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://localhost/"

        # Else we can just use a tcp socket:
        SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>

#2.4.10+can代理到unix套接字
#SetHandler“代理:unix:/var/run/php5-fpm.sock|fcgi://localhost/"
#否则,我们可以使用tcp套接字:
SetHandler“代理:fcgi://127.0.0.1:9000"

你能显示你的HomeController.php代码吗?@MaxGilbert请参阅更新手册中的部分Home controller以了解更新。应用程序肯定位于www/public_html文件夹中,没有正在运行的子目录?是的,它位于/var/www/html目录中;然后,我将/application和/system目录移出documentroot,并显然编辑了index.php以相应地设置应用程序和系统路径
<FilesMatch \.php$>
        # 2.4.10+ can proxy to unix socket
        # SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://localhost/"

        # Else we can just use a tcp socket:
        SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>