Installing PEAR

Although a PEAR subdirectory is created during WAMP installation, PEAR is not included with the Wampserver. To install PEAR open a command prompt window (Start->Run->cmd. Then Enter). Go to the php executables subdirectory and run go-pear.bat:

c:\wamp\bin\php\php5.3.0>go-pear

When prompted set each directory to the following scheme (note: the php version may differ):

1. Installation base ($prefix) : C:\wamp\bin\php\php5.3.0
2. Temporary directory for processing : C:\wamp\bin\php\php5.3.0\tmp
3. Temporary directory for downloads : C:\wamp\bin\php\php5.3.0\tmp
4. Binaries directory : C:\wamp\bin\php\php5.3.0
5. PHP code directory ($php_dir) : C:\wamp\bin\php\php5.3.0\pear
6. Documentation directory : C:\wamp\bin\php\php5.3.0\pear\docs
7. Data directory : C:\wamp\bin\php\php5.3.0\pear\data
8. User-modifiable configuration files directory : C:\wamp\bin\php\php5.3.0\pear\cfg
9. Public Web Files directory : C:\wamp\www
10. Tests directory : C:\wamp\bin\php\php5.3.0\pear\tests
11. Name of configuration file : C:\wamp\bin\php\php5.3.0\pear.ini
12. Path to CLI php.exe : C:\wamp\bin\php\php5.3.0\.

Although go-pear.bat will change php.ini (it will prompt you first) so that include_path points to PEAR, it uses c:\wamp\bin\php\php5.3.0\php.ini rather than C:\wamp\bin\apache\apache2.2.11\php.ini. So after go-pear.bat concludes be sure C:\wamp\bin\apache\apache2.2.11\php.ini has this line (your version of apache may differ)

include_path=".;c:\wamp\bin\php\php5.3.0\pear"

Restart Apache to reload the new php.ini and run phpinfo to verify
include_path.

Change the Windows PATH environment variable to include c:\wamp\bin\php\php5.3.0 (in Windows Vista: Start->Control Panel->System and Maintenance->System->Advanced System Settings->Environment Variable. Edit the PATH system variable and add c:\wamp\bin\php\php5.3.0). Now start a Windows command prompt and type pear. It will list all the pear commands. pear list will list all PEAR packages current installed. Use pear install -o <package> to install a package ( -o will install required dependencies).

Some packages are in beta. To install them you first need to set the preferred release to beta: pear config-set preferred_state beta. Then after installing the beta package do pear config-set preferred_state stable.

PEAR_Frontend_Web package, which was in Beta when this was written, is a web-based front-end alternative to the command line PEAR package manager. To install it open a Windows command prompt and do:

c:\wamp\bin\php\php5.3.0>pear config-set preferred_state beta
c:\wamp\bin\php\php5.3.0>pear install PEAR_Frontend_Web
c:\wamp\bin\php\php5.3.0>pear config-set preferred_state stable

To use the PEAR_Frontend_Web copy <path-to-your-php-installation>\PEAR\docs\PEAR_Frontend_Web\docs\index.php.txt to \wamp\www (or a subdirectroy thereof). I renamed it to pearweb.php. So now http://localhost/pearweb.php starts the web interface (to PEAR package management). You can see the PEAR packages that are installed and install new packages.

http://phphints.wordpress.com/2008/08/26/installing-pear-package-manager-on-wamp/

Leave a Reply