如何让Apache显示我的PHP页面?

I'm a total noob trying to create a website with PHP. I created a small test page that I want to use as the foundation of my grandiose project. I'm having a problem getting my page to display on my browser.

This is my PHP document:

<HTML>   
<HEAD>  
<TITLE>Hello</TITLE>  
</HEAD>   
<BODY>    
<?php echo 'Hello' ?>   
</BODY>   
</HTML>

I have copies of this PHP document saved as all of the following names:

index.php  
index.htm  
index.html

I have all three of these documents saved in the following two locations:

C:/Apache2/htdocs  
C:/My Documents/My Website

This is what's in my httpd.conf:

.   
.   
.   
DocumentRoot "C:/Apache2/htdocs"   
.   
.   
.   
UserDir "My Documents/My Website"   
.   
.   
.   

When I type localhost in my browser, I get:

WinLAMP, she installed successfully.

What do I need to do to get my test page to display when I type localhost in my browser?

Thanks!

First, Make sure your apache server is on and running, it looks like you may have that part already if WinLamp is giving you a successful install message but just double check, I'm using a MAC as a server so I don't use WinLamp. Next dial into your localhost and "/" into your .php doc.

i.e. http://localhost:8800/index.php

** 8800 is the port number I'm using, it could be different for you.

You also need to have PHP installed.

Good Luck

Have you made sure that your Apache configuration is running on port 80? If not your URL to access Apache will be "localhost:ApachePort/index.php", replacing ApachePort with the port specified in httpd.conf. Also, are you sure that PHP was installed with Apache?

Were those directories the default directory during your installation, or did you update it yourself in httpd.cnf? If the latter, you'll need to restart Apache for it to pick up the updates.

Go to Apache2/htdocs/

Make directory named "my" in that folder

Put that "index.php" file of yours in folder "my"

Open browser and enter..

http://localhost/my/

Plus, paste this instead of your code..

<HTML>   
<HEAD>  
<TITLE>Hello</TITLE>  
</HEAD>   
<BODY>    
<?php echo 'Hello'; ?>   
</BODY>   
</HTML>

The web page that you're seeing when you go to http://localhost is located at C:/whereveryouinstalledWinLAMP/Apache2/htdocs/index.html. So if you just replace that index.html with your own index.html, you should get your php page to properly display at http://localhost

Also, your browser may have cached the default index.html for http://localhost so try refreshing after you replace the index.html file.

Additionally, this code:

<HTML>
<HEAD>  
    <TITLE>Hello</TITLE>  
</HEAD>   
<BODY>    
<?php echo 'Hello' ?>   
</BODY>   
</HTML>

just makes a web-site with a title of Hello and doesn't display anything on the page.