Error at Codeigniter “No Input File Specified”

Sometimes life become hell for some unexpected errors. Well, this is not unexpected error, it can be   occurred if you run your application at PHP5 as CGI mode on Apache 2.2.  You may face it if you run your application at shared hosting.

Last week, I ran into this problem when I used Codeigniter for rapid development in one of my client’s applications. The web application worked very well in development environment but it generated the error “No Input File Specified” when I uploaded it shared hosting. By default, the hosting company set cgi.fix_pathinfo to 1.   So, Apache doesn’t support “PATH_INFO” inside Codeigniter. There are two ways to solve it. Before solving the problem, make sure that you have following configurations  at /application/config/config.php in Codeignitet.

$config['index_page'] = “”;
$config['uri_protocol'] = “AUTO“;

Now, either you can customize php.ini at root directory or change the .htaccess.

Make your .htaccess like follwoing..

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

OR customize the php.ini by adding the following line:

cgi.fix_pathinfo = 0;

Happy Hacking 🙂

 

Eftakhairul Islam

Hi, I'm Eftakhairul Islam, a passionate Software Engineer, Hacker and Open Source Enthusiast. I enjoy writing about technical things, work in a couple of startup as a technical advisor and in my spare time, I contribute a lot of open source projects.

 

34 thoughts on “Error at Codeigniter “No Input File Specified”

    1. The only problem I noticed with using this .htaccess approach is that CI’s ‘default controller’ setting (in routes.php) no longer seems to be taking effect, so that I always have to specify the controller name.

  1. I am really thankful for this post. I struggled for a long time with codeIgniter and godaddy. This helped me out

  2. Solved my problem in a single google search. Proves you have helped a lot of them to solve this issue.

    thanks

  3. I have tried the above and a Billion other things… But between all that & deleteing the HTACCESS file… you cant see a smdge of difference ;(

  4. Thanks Lot….So much help full to me……A big problem has been resolved in just few seconds……Again Thanks.. 🙂

Leave a Reply to eftakhairul Cancel reply

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

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Read previous post:
WordPress integration to personal site

Well again I came back to my tech world. Last few days I was too busy for my office's project...

Close