FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP Runs In WinXP Command Window But Not In Browser
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: PHP Runs In WinXP Command Window But Not In Browser [message #173395 is a reply to message #173385] Thu, 07 April 2011 14:09 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Wed, 06 Apr 2011 20:19:00 -0700, Peter Lauren wrote:

> The httpd.conf file gives DocumentRoot "c:/wamp/www/"

The following is something you ABSOLUTELY MUST understand:

DocumentRoot is a definition for the software running on your machine and
is relative to your local file system.

internet www urls know EXACTLY NOTHING about the filesystem of the
machine that is running any given webserver

File name "fred.type" in the directory defined by "DocumentRoot" on the
machine at ip address "a.b.c.d" is referenced with the url: "http//
a.b.c.d/fred.type"

If the machine also has a dns entry that maps name "webserver" to ip
address "a.b.c.d", then the file can also be referenced with the url
"http//webserver/fred.type"

the dns name "localhost" is a special dns name for the special ip address
"127.0.0.1" which means "the same machine as I am", this means that if
your web server is running on the same machine that you are using a web
browser on, you can look at html file "filename.htm" or php file
"filename.php" in the DocumentRoot" by using the urls "http://localhost/
filename.htm" and "http://localhost/filename.php" respectively in the
address bar of your browser.

Note, however, that you REALLY REALLY SHOULD NOT use "localhost" or
"127.0.0.1" in any url inside a file in the "DocumentRoot" directory or
it's sub directories, as the special dns entry and special ip address
will ONLY WORK if you are using a browser on the SAME MACHINE as the
webserver.

So, for example if you want to include a link to the file at "c:\wamp\www
\index.php" inside the file "c:\wamp\www\index.htm" so that you link from
the htm file to the php file when DocumentRoot is "c:\wamp\www", your
link inside the htm file would look something like:

<a href="index.php">link text</a>

And when you access the file "http://localhost/index.htm" and clink on
the link "link text" it should then jump to the output of the php script
"index.php".

Of course, "index.php" needs some php code inside it for this to work.
Try the following line for a start:

<?php echo "<p>Hello, This is php</p>"; ?>

Here endeth the lesson. If you have not now managed to get your server
displaying php files correctly, then either (a) your configuration is
broken, (b) your installation is broken, (c) I screwed up the
instructions, or (d) you're not following the instructions correctly.

If (c) is the case, I'm sure several people will tell us both!

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: neither var_dump() nor die() displays anything
Next Topic: Spaces in filenames
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 21:25:25 GMT 2024

Total time taken to generate the page: 0.04445 seconds