Viewing a webpage using localhost

I want to test out some PHP code I wrote and run a small website through IIS7 just to test it before it gets uploaded to the host. Either my problem is unusual or my Google-fu is weak but here is the problem.

IIS7 - Seems to be working fine. I get the “Welcome” splash page
PHP - Installed and ready to go
But when I try to call up any webpage through local host I get “Internet Explorer cannot disply the webpage.”
I’ve tried a file in the default directory: http://localhost/menu.html
I’ve tried a file in another directory: http://localhost/C:/saintcad/test.html
I’ve tried setting up a virtual domain: http://localhost/

All give the same “Cannot display” error. What am I missing?

In IIS, did you set the site to point to the directory where your index.html/php/asp is located?

Fuck!!! The publishing service wasn’t started even though its on automatic. Working now except it doesn’t want to go to a folder thats not in the default folder but I can figure that out.

First thing I’d suggest is going into your IE advanced settings and turning off the accursed ‘Show friendly HTTP Error messages’ option. (They’re no friend of mine!)

Then you might get to see the error message that IIS7 is actually sending.

The first URL looks fine to me - I’m not sure what you’ve done to set up your virtual domain, but I’d be very surprised if either of the other two links would work. Here’s what I’d generally test first other than the default directory, (in c:\inetpub\wwwroot)…

A subfolder of the default directory - if the local path is c:\inetpub\wwwroot\hithere est.html, then the URL for IIS7 would be http://localhost/hithere/test.html

Setting up a virtual directory - if you set up c:\saintcad\ as the saintcad virtual directory, then you could reach it with http://localhose/saintcad/test.html

Good luck and let us know if you have more questions or updates!

On preview… well, it looks like you’ve got an update, but I think most of the advice above is still good. :slight_smile:

Wait I spoke too soon.
Localhost finds the webpage but the php code is not working. Basic <?php echo “Hello world”; ?> but it is not displaying in my webpage.

Did you check to make sure that PHP was properly registered as a CGI handler or ISAPI application handler in IIS7?

That might be handled by the PHP installer, but I think it requires some tweaking. It’s been a long time since I’ve worked with PHP tho…

Have a look in the IIS logs - if you’re getting 404.1 as the response code, then it isn’t enabled and allowed on that web application.

If memory serves, the handler is registered, but not necessarily set to allowed on websites other than the default. I always seem to forget where stuff is in IIS7 :frowning:

My PHP was working but I apparently missed a fundamental idea in web programming. A php script can be imported (included?) into another php file but not straight into a HTML file. At least I cant find a way to do it without involving javascript which simply is not worth it.

You need to send html files through the PHP parser to solve that problem.

Actually, rewriting everything as php was easier than I thought.

Glad everything worked out ok!

They got the approval of the illustrious girlfriend so this weekend she gets to fill in the content and they go live next Monday.