Murray's Binary Bit Bucket
Home About Books Computing PlayStation Other Stuff
Hardware Problems | Software Problems
 

PHP Gives "No input file specified" Error With IIS

 
 

Problem: When running a PHP script with IIS a "No input file specified" error is shown.

Operating System: Windows 2000 Professional with service pack 4.

Background: A website I was making that uses PHP would only show "No input file specified" whenever I tried to open a PHP page in my browser. This problem only occurred with one website, all other websites that used PHP functioned properly.

Resolution Steps: I first looked in the IIS management console (Start => Settings => Control Panel => Administrative Tools => Internet Services Manager) and compared the settings for the troublesome site with a known good site. All of the settings were identical.

Some research then lead me to look at the php.ini file and in particular the doc_root setting. I had the following setting:

doc_root = "d:\Inetpub\wwwroot"

The comments above this setting say:

; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues. The alternate is to use the
; cgi.force_redirect configuration below

I'm using PHP in ISAPI mode on my development workstation, not CGI, so I tried commenting out the setting so it looked like this:

; doc_root = "d:\Inetpub\wwwroot"

and then I restarted IIS by opening a command prompt (Start => Programs => Accessories => Command Prompt) and type the command:

iisreset

This fixed the problem!

Recommended Reading For PHP Programmers: Programming PHP

 

Did you find my site useful? You can show your thanks
by making your next Amazon purchase through this website.
It won't cost you any extra and Amazon will pay me a small commission.

Search Now:  
Amazon Logo