Pages

CodeIgniter Issues with .htaccess to display No input file specified. error

When running CodeIgniter on Apache 2.2 with PHP5, it display the following error when access url.

No input file specified.

System state:
Apache 2.2
PHP5.2 running as CGI mode with cgi.fix_pathinfo=1 according to PHPINFO().

Problems:
This problem is primary due to running PHP in CGI mode on Apache.

There are two solutions. No matter which one you choose, you will always have the same step 1.

Step 1: Obviously, PHP running under CGI mode has cgi.fix_pathinfo default to 1. Simpley open the /system/application/config/config.php file and make sure the following two options are set.

$config['index_page'] = "";

$config['uri_protocol'] = "AUTO";

Solutions 1:
Step 2: Create a customized PHP.INI file under the root directory of your site with the following line.

cgi.fix_pathinfo = 0;


Solutions 2:
Step 2:
Go to .htaccess file and add question mark after index.php and before slash.
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]

Personally, I choose the Solution 1 with PHP.INI. It seems to run faster.

Problem solved!