Installing PEAR on Linux Web hosting

The file PEAR provides (go-pear.php) currently has a bug that prevents its default implementation from working. We have steps to correct it outlined in this article, but it requires manually modifying the default code. We provide this information as a courtesy and neither guarantee nor support its operation.

PEAR is a structured library of open-source code for users of PHP. The installation requires a specialized file named go-pear.php, which is a modification of your php5.ini file. You also need to password protect the directory you create for the PEAR admin.

To Install PEAR on Linux Web Hosting

  1. Go to http://pear.php.net/go-pear.
  2. Copy the script on the page, and then paste it into a new text document.
  3. Save the new file as go-pear.php.
  4. In a text editor, replace lines 115 through 120 with the following code:
    $bootstrap_files = array(
        'PEAR5.php'            => 'https://raw.githubusercontent.com/pear/pear-core/master/PEAR5.php',
        'PEAR.php'             => 'https://raw.githubusercontent.com/pear/pear-core/master/PEAR.php',
        'Archive/Tar.php'      => 'https://raw.githubusercontent.com/pear/Archive_Tar/master/Archive/Tar.php',
        'Console/Getopt.php'   => 'https://raw.githubusercontent.com/pear/Console_Getopt/master/Console/Getopt.php',
    );
  5. Upload the file to the root level of your hosting account.
  6. Using an Internet browser, locate the file. For example, go to http://coolexample.com/go-pear.php, where coolexample.com is your domain name.
  7. Follow the displayed instructions.

    Note: This installer creates an index.php in the root and overwrites any existing index.php files. To avoid accidental overwrite, you can temporarily rename the current index.php before running the go-pear.php script.

  8. Once the installation completes, update the php5.ini file with include_path. Which path you use depends on your account's PHP version (more info).

    PHP 5.3:
    .:/usr/local/php5_3/lib/php:/[absolutepath]/PEAR
    Other PHP versions:
    .:/usr/local/php5/lib/php:/[absolutepath]/PEAR
    where [absolutepath] is your account's absolute path. For more information, see Find your absolute path.
  9. Create a directory for the PEAR admin, and then password protect it. For more information, see Password Protecting a Directory in Your Shared Hosting Account
  10. Move the index.php that the PEAR installer created to the new directory. The directory is the path for your PEAR admin.

After installing PEAR, you can install modules by going to the PEAR admin at coolexample.com/pearadmin, where coolexample.com is your domain name.


Was dit artikel nuttig?
Thanks for your feedback. To speak with a customer service representative, please use the support phone number or chat option above.
Fijn dat we konden helpen! Kunnen we nog iets voor je doen?
Dat spijt ons. Tell us what was confusing or why the solution didn’t solve your problem.