CodeIgniter – No input file specified error – .htaccess – PHP5 – Apache 2

Speed Coder

Image Source: Day 486 / 365 – Late Night High Level Coding Courtesy Of: JasonRogers

What the heck is this blog post all about? I am warning you that this is going to be a very technical driven blog post.

I felt so funny that this blog got more traffic from search engine to IT related blog posts than to my Internet Entrepreneur Diary or Weekend Confession blog posts. This blog was started with many IT relate topic to records the problems I ran into and the solutions I found. It’s a good time to give it a little update.

Let’s cut to the chase. I am working a new projects that is running on PHP5, Apache 2 and MySQL. I need to get this project done fast and good. So I finally found one of the best choice from so many PHP frameworks. CodeIgniter seems to be the best one fit my needs. It’s very simple and fast. Although it does not support PHP5 OO programming, but it does run on PHP5.


I just ran into problem on my shared hosting server, which is running PHP5 as CGI mode on Apache 2.2 according to PHPINFO(). It throws an error when I access page. “No Input File Specified!” Now the problem is solved!

I have no problem to run the application on my local XP based laptop,which runs PHP5 as Apache Module. Obviously, it’s an Apache error. After reaching on Internet and found the solution. If PHP5 is running on Apache 2.2 as CGI mode, which many web hosting company set as default; Apache is not going to support “PATH_INFO” inside Codeigniter. In order to solve the problem, the solutions is very simple!

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. Simply open /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!

Related Posts Plugin for WordPress, Blogger...

Share your thoughts with me!

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge

Loading Facebook Comments ...