On this page:
Normally when a Web browser looks up a URL the computer contacts the HTTP server with the URL. The HTTP server looks at the filename requested by the computer and then sends that file back. The browser then displays the file in the appropriate format.
However, it is possible to set up the HTTP server so that whenever a file of a specific type is requested that file is not sent back; instead it is executed as a program, and whatever that program outputs is sent back for your computer to display.
Is a server side language. It runs on the server and sends its output via Internet to the browser. This output is standard xhtml or anything you want. The example below gives the same output as the previous example2.html
Very simple php example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>simple document</title> </head> <body> <?php echo '<p>a simple paragraph</p>'; ?> </body> </html>
Here is example8.php. If this file is on a webserver, with php then it outputs a the same as example 2. If the file is on a computer, or on a server without php, then the browser may show an empty screen, or ask you if the file should be downloaded. To see the real page the PHP file needs to be processed by a PHP interpreter.
When you have a local server running then you may call the file from the browser like: http://localhost/htmlintro/example8.php
There are several ways to use php in a web page. The above example is one of them. A common use is the intelligent including of menu section from one single file in different pages. When the menu file is modified, the result is visible in all pages.
Some other examples:
PHP supports also many databases, like MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.) Making a page in PHP is something like writing a report in ABAP. First step is to collect data from a database, from ASCII files, or even from another website. Next is to process this data to make it ready to show it on the screen.
The official php site
For an introduction on PHP, please look at w3schools.
MySQL is very strong in combination with php. Below is a small example program that counts file downloads. The name of this php program is "tel.php". It does not send any output to the browser, it only updates one record of the download table. It uses also a more or less standard SQL language
The official MySQL site
SQL can be learned at the w3schools.
For the fanatic readers, here is the relation between MySQL and SAP.
Updated 2007 Oct. 09