Welcome to the World of PHP Page 3

By Aaron Weiss (Send Email)
Posted Jul 7, 2000


The Very Basics

Unfortunately, installing and configuring your Web server to properly execute PHP pages is not really the focus of this article, and it can be a complex subject due to the variety of operating systems and Web servers that might be involved. From here on in, this article assumes that your Web server is already set up to serve PHP pages. If that's not the case, you'll want to begin at the PHP web site (http://www.php.net) to learn how to download and install PHP for your Web server. If you do not run a Web server, but rather use the services of a Web host, such as an Internet service provider, they will need to support PHP for you.

PHP is not a client-side language. That means that the browser never sees PHP -- only the Web server sees it, and executes it on-the-fly. The browser receives only a "normal" HTML page. To achieve this, PHP code is contained within a special tag, separating it from the other HTML on the page:

<H2>Today's Headline:</H2><BR> <P ALIGN="center">
<?php your php code here ?>
</P><HR>

Consider a very simple sample, where the PHP code simply outputs the phrase "World Peace Declared":

what the web server sees what the web browser receives
<H2>Today's Headline:</H2>
<P ALIGN="center">
<?php print "World Peace Declared"; ?>
</P><HR>
<H2>Today's Headline:</H2> <P ALIGN="center">
World Peace Declared
</P><HR>

And of course, the Web browser will render on-screen:

Today's Headline:

World Peace Declared


 


NEXT ->



Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.