logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: How do I get my PHP page to show as web page on my browser?
Author
Fredashay



Joined: 22 Mar 2012
Posts: 2
Location: USA, Schenectady

PostPosted: Thu 22 Mar '12 1:07    Post subject: How do I get my PHP page to show as web page on my browser? Reply with quote

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 Smile
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Thu 22 Mar '12 10:37    Post subject: Reply with quote

When the script is being displayed in the browser instead of actually processing the script, this is usually caused by the PHP file not having a PHP extension. Example:

phpfile.html

or

phpfile.php.txt

or

phpfile.txt

PHP files should have .php as the extension. Such as phpfile.php
Back to top
Fredashay



Joined: 22 Mar 2012
Posts: 2
Location: USA, Schenectady

PostPosted: Fri 23 Mar '12 1:43    Post subject: Reply with quote

I have my PHP document saved as all of the following:

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

In 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?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Sat 24 Mar '12 13:19    Post subject: Reply with quote

what happens if you open in your browser http://localhost/index.php can you see your test page than?
Back to top


Reply to topic   Topic: How do I get my PHP page to show as web page on my browser? View previous topic :: View next topic
Post new topic   Forum Index -> Other Software