Installing PEAR for PHP



For Windows:

  • To update your PEAR installation, request in your browser and save the output to a local file go-pear.php.
  • Assuming you have installed PHP already, and it is runnable from the command line type php go-pear.php

For FreeBSD:

  • Add the PEAR DB package from the ports /usr/ports/databases/pear-DB

Test Installation

To make sure that PEAR is working simply type in pear at the command prompt. If nothing shows then check that the PEAR path is part of your system path. Check the version of PEAR by typing pear version

To use PEAR and PEAR compatible packages in your applications, you normally include them into your PHP scripts using require_once().  For this to work, PEAR’s php_dir must be a part of PHP’s include path.

First check where PEAR installs php files by typing

pear config-get php_dir

Whatever the folder is, this folder will contain System.php

To find which configuration file is used by your PHP installation. On command line, execute php –ini

When you execute a phpinfo() in the browser it should always the show the PEAR path in its include path for the PEAR packages to work.

Be the first to comment

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.