What Is PHP?

PHP stands for PHP: Hypertext Preprocessor. It is a language that came out of the open source stable, with elements taken from C, Perl, and Java. Fast growing in popularity, PHP is an excellent partner to MySQL and competes with Perl, ASP, and other server-side languages.

Interactivity can be achieved using CGIs (Common Gateway Interfaces). These programs can be written in a number of languages, such as Perl and C (both of whose MySQL APIs you will study in later lessons). However, with CGIs, a program is purely a program and cannot be a Web page.

PHP allows you to embed lines of code within an HTML page. When the Web server receives a request for an HTML file containing PHP, it does not simply serve up the page to the user, but first executes the PHP script within the page.

The script usually results in an HTML page being served back to the user, but it can be generated or customized on-the-fly according to the instructions in the script. At a more complex level, the script may include instructions to interrogate a database, update data stored on the server, send email, make background calls to other servers, and even generate graphics.

The result is totally transparent to the user; there is no indication that the page has been generated especially for the user! The user never gets to see the PHP script and may not even realize it's there.

PHP has a well-developed function library and a range of APIs that enable it to interface with many other server systems, such as databases, POP and IMAP systems, graphic manipulation modules, and much more.

Because PHP is an easy language to learn and experiment with, today's lesson provides a quick guided tour that enables you, even if you are new to PHP, to start writing your own scripts. This is merely an introduction to PHP and leaves considerably more to learn, but the sections on the MySQL API should be sufficient for you to start writing powerful database scripts. For more information on PHP, read one of the many books on the subject such as Sams Publishing's PHP and MySQL Web Development.

Installing and Running PHP

Versions of PHP will run on the various versions of Microsoft Windows, Unix, and Linux, and for the most popular Web servers, including Apache and IIS. PHP can also be used for free under an open source license, whether it's for personal, educational, or commercial use.

The latest version of PHP (currently version 4.2.2) is available from the official PHP Web site at http://www.php.net/. This site is an excellent source of online documentation. Also visit PHP Builder at http://www.phpbuilder.com/, which contains how-tos, discussion archives, and other resources for PHP developers.

This section concentrates on using PHP with Apache. For a guide to installing PHP with Apache, consult the installation notes in the PHP distribution that you download from http://www.php.net/. You should also read the installation notes for Apache, which are available at the Apache Web site, http://httpd.apache.org/, and will be found in the Apache distribution that you download.

Tip

The combination of Linux, Apache, MySQL, and PHP is often known as LAMP. This is a popular combination of software packages among developers who write software for open source platforms.

You should find many resources on the Web for LAMP servers, such as the Web site http://www.onlamp.com/.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.156.202