-----Original Message-----
From: Scott Bounds [mailto:[EMAIL PROTECTED]
Sent: 11 January 2007 07:16
To: php-general@lists.php.net
Subject: Re: [PHP] Please Help with simple Noob problem

Arno, you nailed it right on the head.  You and someone else told me
that.  I am glad that you did because that is exactly what the problem
was.  Thanks for being patient and understanding.

Scott

--
Sure, all part of the learning experience.

Understanding why you can view an html file in a browser but not a php file
is essential: when viewing an html file, it's the browser (client-side)
that's processing and rendering the html code, but the browser can't process
php code. For that you need the webserver (server-side). Browsers are built
to understand and process html and javascript, but only a webserver can
understand and process php script. Unless you're developing or learning, the
browser and the webserver are almost always on different machines (that's
the whole point of the internet!). In your case (and most cases) the
webserver is Apache.

Apache treats html files and php files differently. In the case of html
files it just gets the file and sends it back to the browser, as it was
requested to do. But in the case of php files it opens the file and starts
processing it, i.e. running it as a program.

Apache processes (runs) the php script which generates the html script,
which Apache then sends back to the browser. The browser then processes that
html script and displays the result. It's basically the same concept for all
server-side scripting.

When you type http:// in the browser address bar, you're telling the browser
to communicate with a webserver, using the hypertext protocol. When you type
file:// in the browser address bar, you're telling the browser to
communicate with your local file system. Try
http://local-directory/file.html and you'll see it won't work, whereas
file://local-directory/file.html will work just fine (assuming you've got
file.html in local-directory).

Hope that makes sense.

Arno

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to