Getting and Installing PEAR
PEAR version 1.0 was released in tandem with PHP version 4.3.0. Since then, the PPM and PFC have been included in all default installations of PHP, with exception of the version of PHP installed under Windows through use of the automatic installer.
Typically, there is no need to perform a separate installation of PEAR on a *NIX system. On Windows, however, PEAR will need a manual installation even with the zipped file download of PHP.
On *NIX Systems
As mentioned, PEAR is installed by default with PHP on *NIX systems. No further installation procedure is necessary. Exceptions to this occur on systems where PHP is installed using the --without-pear flag or where PEAR needs to be reinstalled.
lynx -source http://pear.php.net/go-pear | php -q
This will use the lynx Web browser to download the source of the requested site and will pipe it to the php binary, which executes it and proceeds with the installation process. The process will then go through a series of questions to determine where to install PEAR.
On Windows Systems
PHP for Windows comes in two download versions: as a zip package or as an automatic installer. The zip package includes the executable go-pear.bat that may be executed from the command line by changing to the PHP directory and typing go-pear.
If go-pear.bat is not in the PHP installation (because PHP was installed using the automatic installer) or it did not work for some reason, download the source for go-pear and run it. This procedure is similar to that of the *NIX installation.
Grab the go-pear source from http://pear.php.net/go-pear in a Web browser and save it as go-pear.php. Assuming that the command-line interface (CLI) version of PHP is not in the Windows PATH and resides at C:\php\php.exe, after it is downloaded, type the following at a command prompt:
Through a Web Browser
There is one other method to install the PPM, and that is through a Web browser. The unique quality of this method is that the install process is graphical, and the script even creates a Web page from which the PEAR installation may be modified through a browser and not necessarily from the command line. The pear command is still installed, however, so command line use remains an option.
To install the PPM and the PFC through a Web browser, first download the go-pear script as described earlier in the "On Windows Systems" section and save it somewhere in the document root of the machine's Web server. It's probably best to create a folder called pear and save the go-pear script as go-pear.php in that folder.
Now, access go-pear through a Web browser at, for example, http://localhost/pear/go-pear.php. Follow the instructions, and make sure that the Web server has write access to the directory under which PEAR will be installed. The values may be modified to use any directory, not necessarily one in the document root of the Web server.
After proceeding with the installation, PEAR will be installed in the specified directory and a page will be created at http://localhost/pear/index.php that may be used to manage the PEAR installation. If this directory is located on a World-accessible Web server, it's best to password protect it with an .htaccess file so that no one else will be able to access the PEAR management page.