PEAR is stands for PHP Extension and Application Repository and PEAR is available on the Web at http://pear.php.net/. Its purpose is to provide PHP developers with a library of reusable PHP classes(also known as packages), that can easily be integrated into any PHP application and that follow a standard coding style and file structure. PEAR packages are distributed as compressed TAR archives and can be installed to any PHP development system using the PEAR installer.
PEAR packages cover a diverse array of categories. Some of these are:
- User Authentication(Auth, Auth_HTTP)
- Database integration(MDB, DB_DataObject, DB_QueryTool, Query2XML and Structures_DataGrid)
- Form processing(HTML_QuickForm, Validate and Text_CAPTCHA)
- Network protocols(Net_SMTP, Net_POP3, NET_LDAP and Net_FTP)
- File formats(File_PDF, Archive_TAR and Spreadsheet_Excel_Writer)
- Application Localization(118N)
- Benchmarking, Logging and nit testing(Benchmark, Log, PHPUnit)
Installing PEAR Packages
PHP comes with an automated installer for PEAR packages. This installer has the capability to automatically connect to PEAR’s central server, download the requested package and install it to your PHP development environment.
Windows users must first configure the PEAR installer by manually executing the go-pear batch file located in their PHP installation directory. This file will configure the PEAR installer, generate the necessary registry entries and place installer files in the correct locations on the file system.
To install a PEAR package using the installer simply issues the following command at the shell prompt:
Shell>pear install package-name
The PEAR installer will now connect to the PEAR package sever download the package and install it to the appropriate location on your system. Fig 12-1 has an example of installing the net_POP3 package.
If you‘re not able to get the PEAR installer to work correctly try adding the –v option to the installation command line, to display additional debugging information.