php - Codeigniter URI issue...No URI present. Default controller set -


i have issue codeigniter application deployed on ec2 instance on amazon.

$config['base_url'] = 'http://xx.xx.xxx.107/'; $config['index_page'] = 'index.php'; 

this route.php (without particular rule)

$route['default_controller'] = 'home'; $route['404_override'] = ''; $route['translate_uri_dashes'] = false; 

actually if call http://xx.xx.xxx.107/ correctly show first page (it loads default controller home.php , shows home.php view). if call example http://52.59.107.107/index.php/home/sign_in_form, instead of showing sign_in form view, shows again home view.

i enabled log, , get

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, , 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 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 browser debug - 2016-08-08 15:43:25 --> total execution time: 0.1061 

as can see in log, i'm getting debug - 2016-08-08 15:43:25 --> no uri present. default controller set., if i'm calling url http://xx.xx.xxx.107/index.php/home/sign_in_form

here data server:

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 

here vhost apache file:

<virtualhost *:80>    # leave alone. setting tells apache   # vhost should used default if nothing   # more appropriate available.    servername default:80    # required. set directory want use   # “default” site files.    documentroot /var/www/html    # optional. uncomment , set admin email   # address, if have one. if there server error,   # address apache show users.    #serveradmin you@example.com    # optional. uncomment if want specify   # different error log file default.   # need create error file first.    #errorlog /var/www/vhosts/logs/error_log    <directory /var/www/html>     allowoverride   </directory>    proxypassmatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1   directoryindex /index.php index.php </virtualhost> 

is there can tell me i'm failing?

thanks in advance.

updated

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'); } 

as can see prepared simplicity test method in home controller. if call http://xx.xx.xxx.107/index.php/home/test same log sequence , shows home view instead of printing raw data.

it seems not able correct uri, run default controller.

after lot of research , looking inside httpd service log found solution

in vhost file substituted line of code

proxypassmatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1 

with these ones

<filesmatch \.php$>         # 2.4.10+ can proxy unix socket         # sethandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://localhost/"          # else can use tcp socket:         sethandler "proxy:fcgi://127.0.0.1:9000" </filesmatch> 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -