PHP won't redirect to error page
Our site's setup:
We're hosted on an NT server running IIS.
Our site is set to parse .shtml files as PHP since it made for an easier upgrade. Everything works fine except the problem below.
We asked our host's support folks to redirect 404 errors to an error page to make the experience a little easier for visitors.
Here's an interesting quirk. When you type in a nonexistent location like:
http://www.digitalhit.com/bubba.html (notice that's html not shtml) or
http://www.digitalhit.com/bubba
the site redirects to the new error page just fine.
If the file that doesn't exist is an .shtml file or .php3 file it tosses out a "PHP error: Fatal error: Unable to open F:\users\site\www\htdocs\bubba.shtml in - on
line 0 No input file specified." instead of the error page.
Any idea why PHP would jump over IIS's error redirect? Any solutions?
RE: PHP won't redirect to error page
This is an interesting situation. What is happening is that when u do not enter a page that is not to be handled by PHP like .html or .gif , the web server IIS, redirects according to its default redirect settings. But when you request a .shtml page which is processed by PHP, IIS is passing this parameter to PHP as it was configured. Hence PHP is returning a No input file specified error. Apache on the other hand first checks for a missing file and then redirects. I strongly believe that this is a problem with IIS and i am no IIS expert, so tell this to your host and let them correct it. Or else, if you would take my suggestion, log-on to #php on EFNet. But whatever the case, I should mention that support for Windows is slim as most users r Unix-based. Cheers!
RE: PHP won't redirect to error page
IIS is passing a non exsistent page to PHP. PHP cannot generate headers and causes an internal server error. You need to stop IIS from passing non existent files. There is a tick box under the Application Configuration section
In the MMC for Internet Information Server, choose properties for the Web site in question, select Configuration in the Application Section of the Home Directory Tab. Edit the mapping for .php files, a window will pop up with a check box entitled 'Check that file exists' in the lower left hand corner.