Installation and Configuration


PEAR is easy to install, but installation differs slightly depending on which operating system you are using.

Unix Users

Unix (and Mac OS X) users who compile PHP on their own (as explained in Appendix A, "Installation/Configuration") have PEAR compiled for them, and the program is usually put in /usr/local/bin.

To verify installation success, execute the following command:

 # pear V 

You should see something similar to the following, depending on which version of PHP you are running:

 PEAR Version: 1.3.2 PHP Version: 5.0.4 Zend Engine Version: 2.0.4 Running on: FreeBSD akira 4.11-RELEASE FreeBSD 4.1-RELEASE #0:    Mon Oct i386 

Users who download and install PHP via prepackaged solutions such as RPMs and their ilk should verify that the pear command installed correctly. If it has not, they should either consult with the package maintainer or consider building PHP from scratch as shown in Appendix A, which will give them much greater control and flexibility over which options are installed and configured.

Unix users should edit the php.ini currently in use on their system (typically found in /usr/local/lib/php.ini) and verify that the include_path variable includes the default directory into which PEAR files are sent, /usr/local/lib/php:

 include_path = ".:/usr/local/lib/php" 

Windows Users

Because most users of PHP on Microsoft Windows do not build it themselves, you need to perform one extra step to get PEAR running on these systems. After installing PHP, you will notice in your installation directory (C:\PHP) a program called go-pear.bat. By running this program, you can correctly install and configure PEAR on your machine.

After running the command, you should see the following:

 C:\PHP>go-pear.bat Welcome to go-pear! Go-pear will install the 'pear' command and all the files needed by it.  This command is your tool for PEAR installation and maintenance. Go-pear also lets you download and install the PEAR packages bundled with PHP: DB, Net_Socket, Net_SMTP, Mail, XML_Parser, PHPUnit. If you wish to abort, press Control-C now, or press Enter to continue: 

Press Enter to continue installation. You will then be asked about any proxy information. Either enter this information in the form of a URI, as follows, or just press Enter to indicate that you have no proxy server on your network:

 http://user:password@proxy.host.name:portnumber 

go-pear then gives you a list of configuration options, which rarely need to be changed. You can just press Enter to accept the default locations for PEAR and its components.

 Below is a suggested file layout for your new PEAR installation.  To change individual locations, type the number in front of the directory.  Type 'all' to change all of them or simply press Enter to accept these locations.  1. Installation prefix           : C:\PHP  2. Binaries directory            : $prefix  3. PHP code directory ($php_dir) : $prefix\pear  4. Documentation base directory  : $php_dir\docs  5. Data base directory           : $php_dir\data  6. Tests base directory          : $php_dir\tests  7. php.exe path                  : C:\PHP\php.exe 1-7, 'all' or Enter to continue: 

You can then indicate whether you want some of the most common PEAR classes pre-installed for you, such as DB and Mail:

 The following PEAR packages are bundled with PHP: DB, Net_Socket, Net_SMTP, Mail, XML_Parser, PHPUnit. Would you like to install these as well? [Y/n] : 

You accept this by pressing Enter or typing the letter y and then pressing Enter. To refuse the installation of these classes, type n and press Enter.

PEAR will then churn for a while, install some components, and finally verify whether C:\PHP\PEAR is included in PHP's default include_path in php.ini. If not, it offers to perform this change to php.ini for you:

 WARNING!  The include_path defined in the currently used  php.ini does not contain the PEAR PHP directory you just specified: <C:\PHP\pear> If the specified directory is also not in the include_path used by your scripts, you will have problems getting any PEAR packages working. Would you like to alter php.ini <c:\windows\php.ini>? [Y/n] : y php.ini <c:\windows\php.ini> include_path updated. Current include path           : .;C:\php5\pear Configured directory           : C:\PHP\pear Currently used php.ini (guess) : c:\windows\php.ini Press Enter to continue: 

After completing this step, you might still want to open php.ini in your favorite text editor to verify that the configuration was correct. The include_path variable should at least contain the following directories:

 include_path = ".;c:/php/includes;c:/php/PEAR" 

After completing the installation and configuration, you can verify the existence of the PEAR program by running the following:

 C:\PHP> pear -V 

The output of this command should be similar to this:

 PEAR Version: 1.3.5 PHP Version: 5.0.4 Zend Engine Version: 2.0.4 Running on: Windows NT SAKURA 5.1 build 2600 

Note that the pear command is typically not in your path on Windows machines, so you will either need to always run it from the directory in which it is installed (C:\PHP) or add that directory to your PATH environment variable.




Core Web Application Development With PHP And MYSQL
Core Web Application Development with PHP and MySQL
ISBN: 0131867164
EAN: 2147483647
Year: 2005
Pages: 255

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net