Installing PEAR on Linux Web hosting
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
- Go to http://pear.php.net/go-pear.
- Copy the script on the page, and then paste it into a new text document.
- Save the new file as go-pear.php.
- 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', );
- Upload the file to the root level of your hosting account.
- Using an Internet browser, locate the file. For example, go to http://coolexample.com/go-pear.php, where coolexample.com is your domain name.
- 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.
- 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]/PEAROther PHP versions:.:/usr/local/php5/lib/php:/[absolutepath]/PEARwhere
[absolutepath]is your account's absolute path. For more information, see Find your absolute path.
- 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
- Move the
index.phpthat 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.