PEAR Articles

  Home arrow PEAR Articles arrow Page 3 - PEAR: an Introduction
PEAR ARTICLES

PEAR: an Introduction
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2010-07-21

    Table of Contents:
  • PEAR: an Introduction
  • The Power of PEAR: Converting Numeral Formats
  • Installing and Updating PEAR
  • Updating PEAR

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    PEAR: an Introduction - Installing and Updating PEAR


    (Page 3 of 4 )

    PEAR has become such an important aspect of efficient PHP programming that a stable release has been included with the distribution since version 4.3.0. Therefore, if you’re running this version or later, feel free to jump ahead and review the section “Updating Pear.” If you’re running PHP version 4.2.X or earlier, in this section you’ll learn how to install the PEAR Package Manager on both the Unix and Windows platforms. Because many readers run Web sites on a shared hosting provider, this section also explains how to take advantage of PEAR without running the Package Manager.

    Installing PEAR

    Installing PEAR on both Unix and Windows is a trivial matter, done by executing a single script. Instructions for both operating systems are provided in the following two subsections.

    Installing PEAR on Linux

    Installing PEAR on a Linux server is a rather simple process, done by retrieving a script from the
    http://go-pear.org/Web site and executing it with the PHP binary. Open up a terminal and execute the following command:

    %>lynx -source http://go-pear.org/ | php

    Note that you need to have the Lynx Web browser installed, a rather standard program on the Unix platform. If you don’t have it, search the appropriate program repository for your particular OS distribution; it’s guaranteed to be there. Alternatively, you can just use a standard Web browser such as Firefox and navigate to the preceding URL, save the retrieved page, and execute it using the binary.

    If you’re running PHP 5.1 or greater, note that PEAR was upgraded with version 5.1. The improvements are transparent for users of previous versions, however, the installation process has changed very slightly:
    %>lynx -source http://pear.php.net/go-pear.phar | php.

    No matter the version, once the installation process begins, you’ll be prompted to confirm a few configuration settings such as the location of the PHP root directory and executable. You’ll likely be able to accept the default answers (provided between square brackets that appear alongside the prompts) without issue. During this round of questions, you will also be prompted as to whether the six optional default packages should be installed. It’s presently an all-or-none proposition; therefore, if you’d like to immediately begin using any of the packages, just go ahead and accede to the request.

    Installing PEAR on Windows

    PEAR is not installed by default with the Windows distribution. To install it, you need to run thego-pear.batfile, located in the PHP distribution’s root directory. This file installs the PEAR command, the necessary support files, and the aforementioned six PEAR packages. Initiate the installation process by changing to the PHP root directory and executing
    go-pear.bat, like so:

    %>go-pear.bat

    You’ll be prompted to confirm a few configuration settings such as the location of the PHP root directory and executable; you’ll likely be able to accept the default answers without issue. During this round of questions, you will also be prompted as to whether the six optional default packages should be installed. It’s presently an all-or-none proposition; therefore, if you’d like to immediately begin using any of the packages, just go ahead and accede to the request.


    Note  While the PEAR upgrade as of version 5.1. necessitates a slight change to the installation process on Unix/ Linux systems, no change is necessary for Windows, although PHP 5.1’s Windows port also includes the upgrade.


    For the sake of convenience, you should also append the PHP installation directory path to thePATHenvironment variable so the PEAR command can be easily executed.

    At the conclusion of the installation process, a registry file namedPEAR_ENV.regis created. Executing this file will create environment variables for a number of PEAR-specific variables. Although not critical, adding these variables to the system path affords you the convenience of executing the PEAR Package Manager from any location while at the Windows command prompt.


    Caution  Executing thePEAR_ENV.regfile will modify your system registry. Although this particular modification is innocuous, you should nonetheless consider backing up your registry before executing the script. To do so, go to Start ➤ Run, executeregedit, and then export the registry via File ➤ Export.  


    PEAR and Hosting Companies

    If your hosting company doesn’t allow users to install new software on its servers, don’t fret because it likely already offers at least rudimentary support for the most prominent packages. If PEAR support is not readily obvious, contact customer support and inquire as to whether they would consider making a particular package available for use on the server. If they deny your request to make the package available to all users, it’s still possible to use the desired package, although you’ll have to install it by a somewhat more manual mechanism. This process is outlined in the later section “Installing a PEAR Package.”

    More PEAR Articles Articles
    More By Apress Publishing

    blog comments powered by Disqus

    PEAR ARTICLES ARTICLES

    - Installing PEAR
    - PEAR: an Introduction
    - Managing robots.txt using PHP: Generating Dy...
    - Deleting Authors from a PEAR Content Managem...
    - PEAR CMS: Index and Delete Scripts
    - Listing Articles for a PEAR Content Manageme...
    - Building an Authors Page for a PEAR CMS
    - Building the View Details Page in a PEAR CMS
    - Creating the Main Pages of a PEAR CMS
    - Completing the Login Script for a PEAR CMS
    - User Authentication for a PEAR CMS
    - A PEAR CMS: Examining the Code
    - Building a Content Management System with PE...
    - Installing a PEAR Package
    - My PEAR: The Beginning


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 4 - Follow our Sitemap