Problem with dynamic 404 error page in php on iis

I am running IIS 5 with php

I want a dynamically generated 404 error page

I definded my 404error.php  page in the custom errors section of my website settings

when i run the page the file is returned but the php scripts do not run. In fact they actually show up as body copy

does any one have any advice?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

First, does php run at all? (Create a new file with <?php phpinfo(); ?> in it, and make sure it gets run.)

Have you tried defining a normal html page as the error page and putting a simple redirect to the php page on the html page?
mediatimebombAuthor Commented:
yes php runs and i would rather avoid yet another redirect expecially off the 404 page.

i need to read some variable e.g. what page was called right on the 404 if i pass it in a simple ridirect i cannot do this
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Well, you could

Page 404.html

window.location = "404.php"

Page 404.php
$thepage = $_SERVER['HTTP_REFERER'];
404 page not found, you request page <?php echo($page); ?> and it was not found.. please check the URL and try again, blah blah blah

Because if I remember correctly, the 404 page is not redirected, rather the page requested is re-written with the contents of the 404 page. Thus the referer is still going to be the page requested.

mediatimebombAuthor Commented:
I do appreciate the above suggestions but they are not the solution i need for this to work. I do now want to run sripts on this page the purpose of me wanting to run php on the 404 page is to get a dynamic site map on there will links that SEO spiders can crawl. Having a javascript redirect will put a stop to that

PAQed with points refunded (250)

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.