What Is PHP?

PHP is a server-side scripting language. When your Web browser accesses a URL, it is making a request to a Web server. If you are requesting a PHP page, something like http://www.yourcompany.com/home.php, the Web server wakes up the PHP parsing engine and says, "Hey! You've got to do something before I send a result back to this person's Web browser." The PHP parsing engine runs through the PHP code found in the home.php file and returns the resulting output. This output is passed back to the Web server as the HTML code in the document, which in turn is passed on to your browser, which displays it to you.

A Brief History of PHP

In 1994, an incredibly forward-thinking man named Rasmus Lerdorf developed a set of tools that used a parsing engine to interpret a few macros here and there. They were not extravagant: a guest book, a counter, and some other "home page" elements that were cool when the Web was in its infancy. He eventually combined these tools with a form interpretation (FI) package he had written, added some database support, and released what was known as PHP/FI.

Then, in the spirit of Open Source software development, developers all over the world began contributing to PHP/FI. By 1997, more than 50,000 Web sites were using PHP/FI to accomplish different tasks-connecting to a database, displaying dynamic content, and so on.

At that point, the development process really started becoming a team effort. With primary assistance from developers Zeev Suraski and Andi Gutmans, the version 3.0 parser was created. The final release of PHP3 occurred in June of 1998, when it was upgraded to include support for multiple platforms (it's not just for Linux anymore!) and Web servers, numerous databases, and SNMP (Simple Network Management Protocol) and IMAP (Internet Message Access Protocol).

After PHP 3.0 was released, the aforementioned Suraski and Gutmans began to develop a super-fast engine to replace the core elements of PHP, and in mid-1999 the Zend Engine was born. PHP 4.0 was based on this engine, and was released in the Spring of 2000. This release was a watershed for PHP-the vast amount of new featues and incresed performance results now found in PHP 4.0 made it a viable tool for advanced Web application development. The current version is PHP 4.3, which you'll learn to install in Chapter 1, "Getting Started with PHP."

In the three years between the appearance, in early 2000, of the first edition of this book and this newest edition, PHP usage has exploded. Companies like Amazon.com and Yahoo! use PHP in various areas of their Web sites. That's definitely high praise! The most recent survey from Netcraft (http://www.netcraft.com/) show PHP is installed on over 9.5 million domains. It is commonplace for Internet Service Providers to offer PHP and MySQL in even the most basic (or free!) hosting packages, and PHP source code is shipped with most Linux distributions.

Additionally, there are hundreds of books which address PHP development in some way-a marked increase from the five or so which were available when the first edition of this book was published. The tens of thousands of developers who use and contribute to PHP have made this simple language near-revolutionary, and those numbers continue to grow.

What Does PHP Do?

PHP does anything you want, except sit on its head and spin. Actually, with a little on-the-fly image manipulation and Dynamic HTML, it can probably do that, too.

According to the PHP Manual, "The goal of the language is to allow Web developers to write dynamically generated pages quickly."

The list below show some common uses of PHP. This is by no means a complete list, and doesn't indicate any of the more advanced functionality that developers use in large applications; it's just an idea of the items that your average developer may use on a daily basis.

  • Perform system functions: create, open, read from, write to, and close files on your system, execute system commands, create directories, and modify permissions.

  • Gather data from forms: save the data to a file, send data via e-mail, return manipulated data to the user.

  • Access databases and generate content on-the-fly, or create a Web interface for adding, deleting, and modifying elements within your database.

  • Set cookies and access cookie variables.

  • Use PHP user authentication to restrict access to sections of your Web site.

  • Create images on-the-fly.

  • Encrypt data.

A Note Regarding Open Source Development

Open Source software must follow these criteria (they are available in detail at http://www.opensource.org/):

  • Free redistribution.

  • The program must include source code and must allow distribution in source code as well as compiled form.

  • The license must allow modifications and derived works.

  • Integrity of the author's source code.

  • No discrimination against persons or groups.

  • No discrimination against fields of endeavor.

  • Distribution of license.

  • License must not be specific to a product.

  • License must not contaminate other software.

PHP is a fine example of Open Source development and distribution. Other examples include the following:

  • Apache. The Web Server of choice for more than 4.8 million Web sites.

  • Linux. The operating system of choice for more people than Microsoft would have you think.

  • BIND. The software providing Domain Name Services to the Internet-all of it.

  • Sendmail. The most widely-used software for transporting e-mail from sender to recipient.

Synonymous with "Open Source" is "volunteerism." Developers contributing to Open Source software don't directly make money from doing so. Wherever possible, contribute to your favorite Open Source organization, be it the PHP Group or someone else. Give back some time by answering questions, helping with documentation, contributing code where possible, or even making a monetary donation. The cost of equipment, connectivity, tools, and, most importantly, brainpower is absorbed directly by the volunteer developer, so that you and I have a freely (and widely) available piece of software.



PHP Essentials
PHP Essentials, 2nd Edition
ISBN: 1931841349
EAN: 2147483647
Year: 2002
Pages: 74

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net