Chapter 16. PHP

PHP (PHP Hypertext Preprocessor) is a web scripting language. PHP is easy to learn because it builds on the bits and pieces that most people already know. The pieces that you don’t know are filled in by excellent online documentation and many high-quality books. This simple approach to solving the web problem has caught on with an amazing number of people.

This chapter provides an overview of the main concepts needed for most web applications, followed by quick reference material for most of the main PHP functions. For complete coverage of PHP, refer to Programming PHP by Rasmus Lerdorf and Keven Tatroe.

Installation and Configuration

PHP works with many different web servers in many different ways, but by far the most popular way to run PHP is as an Apache module with Apache 1.3.x. Full installation instructions for all the different ways to install PHP can be found in the PHP documentation. Here, I cover the Apache module installation.

If you are compiling from the PHP source tarball, follow the instructions in the INSTALL file found inside the PHP distribution file. A tarball is a compressed tar file. tar stands for tape archive, but these days it has little to do with tapes. It is simply a way to lump multiple files and directories into a single file for distribution. Normally tarballs have the .tar.gz extension to indicate a tar file compressed with gzip. To untar a tarball, use:

tar zxvf foo.tar.gz

On Windows, many utilities (including WinZip) understand ...

Get Webmaster in a Nutshell, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.