smaller reset larger         

Main Menu

All times are in GMT -7 (DST) :: The time is now 4:54 am.

Sub Menu

Article Data
Article Ref
5222-EIAC-0855
Written By
Quinn Whipple
Date Created
Sat, 4th Apr 2009
Date Modified
Wed, 4th Jun 2014
 
(Lost?)

   404 error "No input file specified" PHP CGI

Question 

My website is returning a 'No input file specified' error rather than a 404 error page when an invalid php page is accessed. Why is this happening and can I fix it?

Answer 

When running PHP as a CGI Binary and not in library mode, Apache will send any PHP based request directly to the php executable without verifying if the request is valid. This can cause seemingly random errors such as the 'No input file specified' message. The good news is that this is easily resolved by using an .htaccess directive.

Here is the code that you will want to use to resolve this issue,

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule ^.+\.php$ /junkfile
 

This code will work so long as you do not have a file called 'junkfile' in your default content tree.

Article Comments 

There are currently no comments.