Welcome to the World of PHP Page 3

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 ?>

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"; ?>
<H2>Today's Headline:</H2> <P ALIGN="center">
World Peace Declared

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

Today's Headline:

World Peace Declared



This article was originally published on Jul 7, 2000

Thanks for your registration, follow us on our social networks to keep up-to-date