Search | Directories | Reference Tools
UW Home > UWIN > Computing and Networking > Web > Web Publishing > PHP 

Installing PEAR on Your Account

Summary

PEAR is like perl's CPAN or ruby's gems. It's a means of distributing chunks of reusable code. You can read about it in greater details on the PEAR Web site. It's also now pretty easy to install on your UW Web publishing account so that you can take advantage of this code repository.

Included on this page:

Installing PEAR

These instructions assume that you're in your public_html directory.

  1. Create a new directory in your public_html directory called "web_pear" and change to that directory.

    mkdir web_pear; cd web_pear
  2. Add some authentication to this directory.

    1. Create an .htaccess file.

      pico .htaccess
    2. Use UW NetID authentication to protect this directory by adding the following text to the .htaccess file.

      AuthType UWNetID
      require user UWNetID

      Where UWNetID is your UW NetID.

    3. Save and exit the .htaccess file.

  3. Download the PEAR installation script.

    wget http://pear.php.net/go-pear -O go-pear.php
  4. Open a browser and go to the URL for the go-pear.php file that you just downloaded:

    http://accountType.washington.edu/UWNetID/web_pear/go-pear.php

    Note: accountType should be replaced with staff, faculty, depts, courses, or students. Use whichever of these you normally use to view your website. UWNetID will be replaced with your UWNetID.

  5. Do the PEAR installation.

    1. click the "Next >>" link.

    2. On the configuration screen, delete the "/nfs/aesop##" part of the "Installation prefix" config variable.

    3. Check the "Install those too" box.

    4. Click the "Install" button.

    5. Wait for the progress bars to finish.

    6. Edit the address in your browser to remove everything after "web_pear/" and press enter.

  6. Optional: You can remove that error at the top of the PEAR interface that says "Warning: This package management website is not protected with a password, this is a MAJOR security risk. Please read the README." In order to remove this warning, un-comment the 16th line in the index.php file in your web_pear directory.

  7. PEAR is installed. In order to actually use the modules that you install with PEAR, you will need to add it to your include_path.

Fix Your include_path

  1. Make sure you're in the public_html directory.

    cd ~/public_html
  2. Copy the system php.ini file to your public_html directory.

    cp /usr/local/lib/php/php.ini-dist ./php.ini
  3. Open the php.ini file to line 458 with pico. This line is where the include_path variable is set if you're using the provided php.ini file. If you're using a custom php.ini, or you've already made changes to it, the include_path variable may not be on line 458.

    pico +458 php.ini
  4. Un-comment and edit the include_path variable. You can find the path to your PEAR installation by using the "wwwhome" command, and adding the web_pear directory to the end of the output.

    Change

    ;include_path = ".:/php/includes"

    to

    include_path = ".:(the path to your PEAR installation)"
  5. Save the php.ini file and exit pico.