How do I get my PHP page to show as a web page on by browser?

Discussion in 'Apache' started by Fredashay, Mar 21, 2012.

  1. #1
    Noob question coming at ya'. I'm a programmer, but am new to web development. I want to build a web site using PHP and MySQL. I just downloaded and installed WinLAMP under Windows 7 (I'll be using a hosting service when the site goes live, I just want to develop it locally). I then wrote a simple PHP page like this:

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

    When I pointed my browser to it, it just displayed a blank page. Obviously, Apache isn't "serving" this page to me through my browser. When I try to start Apache, it tells me that it's already active. Do I need to put this page in some special folder under Apache? Or set some configuration setting in Apache so that it will display this page when I view 'localhost' in my browser?

    Thanks for any help you can give me :)
     
    Fredashay, Mar 21, 2012 IP
  2. ctrenks

    ctrenks Member

    Messages:
    17
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #2
    Im sure you have a document root for apache, like a public_html directory. I never messed with apache on windows but there has to definately be a doc root..
     
    ctrenks, Mar 22, 2012 IP
  3. Fredashay

    Fredashay Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes. I saved my page as index.php in C:/Apache2/htdocs

    But when I type localhost, I still get the page that says Apache was installed successfully, instead of my test PHP page.
     
    Fredashay, Mar 22, 2012 IP
  4. ctrenks

    ctrenks Member

    Messages:
    17
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #4
    somewhere you have an idex page that is showing that, do a search for index.xxx in you apache2 directory
     
    ctrenks, Mar 23, 2012 IP
  5. ctrenks

    ctrenks Member

    Messages:
    17
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #5
    Also, Be sure that you remove index.html as it will show before index.php..
     
    ctrenks, Mar 23, 2012 IP