6

I am using FastCGI to setup PHP. I've followed the instructions on the iis.net website. I added the handler mapping, edited the php.ini file as specified. None of it works, I just get a 404.0 error saying "The page you are looking for has been removed", even though the physical path displayed on the error page exists. After trying this manual method (unzipping php, manually adding handle mapping, etc), I removed everything and I tried the Web Platform Installer (ugh) but I still have the same issue.

A little more information:
The Detailed Error page says the handler is my StaticFile handler (not PHP FastCGI). It also gives error code 0x80070002

When I look at the logs, it shows "GET /php.ini" as giving the 404 error. Why is IIS looking for that?

9 Answers 9

6

Just wanted to add the stupid answer encase anyone else find this issue with the same problem. "A mate" created the test file on the server. He was getting the 404 error. What had happened, was that windows was hiding file extensions, so the file was actually called index.php.txt... Not a funny 30 minutes.

1
  • 1
    I like to think this isn't a stupid answer. And not just because this happened to me! Thanks.
    – Jay Riggs
    Oct 6, 2017 at 7:38
3

Well, I'm not sure what I did, but somehow I fixed it. I removed the website and re-added it, then checked my FastCGI Mapping settings, everything looked just like before, but this time it works. I'd still like to know why I was getting the error if possible.

1
  • Another one of those absurd solutions that just works.
    – CarComp
    May 31, 2023 at 19:41
3

When I was getting this error message I noticed that I didn't even have php-cgi.exe file in the C:\Program Files\PHP directory.

The other helpful method I found was that if you are getting FastCGI errors, to try double clicking directly on the php-cgi.exe file and then look in the Windows Application logs for errors if it crashes. I got this from this comment from a PHP Bug report:

[2010-04-22 06:43 UTC] sejo at iteontech dot com

After debugging IIS and a bunch of other crazy things, this is what worked for me. I have PHP 5.3.2 on Windows 7 and IIS 7. Try to execute PHP-CGI.EXE (BY DOUBLECLICKING ON IT). See if you get any error messages/ pop-ups. I got a ton of them and it all boiled down on having a bunch of extensions turned on, but not being available in my ext folder. Clear the PHP.INI of those invalid extensions and the problem should go away.

1
  • 2
    +1 Double-click on php-cgi.exe file was a winner for me. The error showed that I was missing msvcr110.dll
    – LarryK
    Dec 2, 2014 at 10:35
2

By default IIS will not serve any file for which it does not have a valid MIME Type mapping and will 404 the response

If the .php extension does not have a MIME type defined for it for the website that you're trying to run PHP then IIS will not serve the file even if there is a relevant handler for that file type.

Just checked the IIS 7 Manager on my server and there is no mapping for PHP by default in the MIME Types list, I suspect that if your website existed before you installed FastCGI it does not automatically add the mapping to existing websites whereas when you created the new website FastCGI was already installed.

I could of course be completely wrong about that last bit but the File extension to MIME Type mapping issue is a security feature of IIS - no mapping = no files served with that extension

1

My solution to this error had two parts:

  1. (from @icc97's answer) -- double-click on php-cgi.exe in your PHP folder to make sure it can start up ok.
  2. Turns out that my index.php file was really named index.php.htm (turn off "hide file extension names")
0

I dealt with a similar issue, all replies I could find on the web were of no help whatsoever. First off I assume you have tried running http://yourservernamehere/check.php and everything seems to come back correct. IF this is the case I would suggest checking in your php.ini file the setting under:

[Date] ; Defines the default timezone used by the date functions date.timezone =

Most likely it is blank like mine was, this generates a silly error with newer version of php and for whatever reason you will be dead in the water until you have a timezone specified (mine is America/Chicago).

I may be assuming a lot about your situation but it sounds very similar to mine and I spent several days frustratedly searching for an answer.

3
  • It was blank, but adding the timezone did not fix the issue.
    – scottm
    Feb 26, 2010 at 19:23
  • Sorry to hear that, but maybe you saved yourself some more headche for further down the road at least. Reading your question again I see you went back and reinstalled with the installer, in my experience that does not typically work, I would suggest going back to the manual install method before even beginning to continue troubleshooting. Also, did you add the location of the install to your environment variables?
    – Charles
    Feb 26, 2010 at 19:59
  • I have started over with the manual installation. It's now showing that it's using my 'PHP via FastCGI' mapping, but still results in a 404 page.
    – scottm
    Feb 26, 2010 at 20:09
0

Is there any reason you aren't using the installer to do the work for you?

Also, can you confirm that the .php handler mapping is correctly set?

Path : *.php
State : Enabled
Path Type : File or Folder
Handler : FastCgiModule
1
  • THe installer resulted in the same problem. When I browse to the page on the server, it shows that it's using the FastCGI module. I am positive the mapping is correct.
    – scottm
    Mar 1, 2010 at 15:08
0

I had this issue today but none of the fixes above worked for me. I turned on detailed error handling in IIS and discovered I was receiving a 404.7 error: 'The request filtering module is configured to deny the file extension'.

I went into the 'Request Filtering' menu within the IIS manager, added '.php' as an approved file type and this fixed the issue for me.

0

When I had this problem, it was because in php.ini, open_basedir was set but did not allow the folder where my PHP files were. Adding the folder to open_basedir fixed the problem.

I don't know why I was getting 404.0 errors. If open_basedir was not properly configured, I would expect error 403.2.

Not the answer you're looking for? Browse other questions tagged .