Skip to Main Content
PHP in a Nutshell
book

PHP in a Nutshell

by Paul Hudson
October 2005
Intermediate to advanced content levelIntermediate to advanced
372 pages
11h 35m
English
O'Reilly Media, Inc.
Content preview from PHP in a Nutshell

PEAR

The PHP Extension and Application Repository, or PEAR for short, contains re-usable code written by others that enables you to create powerful scripts using just a few simple commands.

PEAR contains two types of pre-written code: PECL code and PHP code . PECL code, as mentioned already, are full extensions written in C that interact with external libraries. Extensions reside in PECL when they are considered useful, but not popular or much used. However, most of PEAR is PHP code, which means you can use it on any PHP server without enabling any extensions or recompiling PHP.

The most famous package in PEAR is called PEAR::DB, and provides an object-oriented, database-independent framework for reading from and writing to your database. PEAR::DB is covered in depth in Chapter 14.

PHP comes with "go-pear," an easy way to configure PEAR for use on your computer. To use it, simply run go-pear from the command line and follow the on-screen instructions. Windows users will need to change to the directory where PHP is, e.g., c:\php.

The output of go-pear is shown in Figure 3-1.

Once you have PEAR installed on your system, you will see the pear command—this allows you to search for and download new PEAR modules for your PHP installation.

Running go-pear will set up PEAR on your computer

Figure 3-1. Running go-pear will set up PEAR on your computer

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PHP Cookbook

PHP Cookbook

Eric A. Mann
Programming PHP

Programming PHP

Rasmus Lerdorf, Kevin Tatroe
Learning PHP

Learning PHP

David Sklar

Publisher Resources

ISBN: 0596100671Errata Page