Troubleshoot: PHP `No Input File Specified` Error

Are you using pretty URL on your web application or website? Having problem with “No input file specified error” from PHP? Confused why my PHP code is not working? The PHP code is working flawlessly on localhost but why is not  working now? Which php file is causing this error? Is it web server or PHP related problem?

If some of questions answer is yes and when you are using .htaccess to create pretty URL and removing index.php on your URL like from:


with the following .htaccess file:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [NC,L,QSA]
You may notice that on some web server configuration the above .htaccess code is not going to work and PHP just throw “No Input file specified.”, then this “workaround” might work for you. Change to following line on your .htaccess file:
RewriteRule ^(.*)$ /index.php/$1 [NC,L,QSA]
RewriteRule ^(.*)$ /index.php?/$1 [NC,L,QSA]
Yes, just put one question mark after index.php file to make it work. This is a common problem faced by popular framework and CMS like CodeIginiter, ExpressionEngine from EllisLab and also Panada Framework may also suffer from this problem. This problem may occur when you are using/upgrading to PHP 5.3.