The PHP software works with the Web server. The Web server is the software that delivers Web pages to the world. When you type a URL into your Web browser's address bar, you're sending a message to the Web server at that URL, asking it to send you an HTML file. The Web server responds by sending the requested file. Your browser reads the HTML file and displays the Web page. You also request a file from the Web server when you click a link in a Web page. In addition, the Web server processes a file when you click a Web page button that submits a form.
NOTE
When PHP is installed, the Web server is configured to expect certain file extensions to contain PHP language statements. Often the extension is .php or .phtml, but any extension can be used. (In this book, we assume that .php is the extension for PHP scripts.) When the Web server gets a request for a file with the designated extension, it sends the HTML statements as is, but PHP statements are processed by the PHP software before they're sent to the requester.
When PHP language statements are processed, only the output is sent by the Web server to the Web browser. The PHP language statements aren't included in the output sent to the browser, so the PHP code is secure and transparent to the user. For instance, in this simple PHP statement:
<?php echo "<p>Hello World</p>"; ?>
<?php is the PHP opening tag, and ?> is the closing tag. echo is a PHP instruction that tells PHP to output the upcoming text. The PHP software processes the PHP statement and outputs the following:
<p>Hello World</p>
which is a regular HTML statement. This HTML statement is delivered to the user's browser. The browser interprets the statement as HTML code and displays a Web page with one paragraph — Hello World. The PHP statement isn't delivered to the browser, so the user never sees any PHP statements. PHP and the Web server must work closely together.
PHP isn't integrated with all Web servers but does work with many of the popular Web servers. PHP is developed as a project of the Apache Software Foundation — thus, it works best with Apache. PHP also works with Microsoft IIS/PWS, iPlanet (formerly Netscape Enterprise Server), and others.
|
18.116.37.62