The most commonly used PEAR package for database access is PEAR DB. DB is a database abstraction layer that provides a single API for querying most of the databases supported by PHP, as well as some more database-specific things in a portable way, such as sequences and error handling. PEAR DB itself is written in PHP, and has drivers for most of PHP's database extensions.
In this section, you learn how to use PEAR DB, and when it makes sense to use PEAR DB instead of using one of PHP's database extensions natively.
To install PEAR DB, you need the PEAR Installer that is installed along with PHP. Use the following command:
$ pear install DB
If you have problems, see Chapter 10, “Using PEAR.”