I just spent a good 2 hours trying to get a local copy of PEAR to work. Here are the steps I took, in case anyone else finds this useful. YMMV, YRMV, etc.
- Create a ~/pear dir and set the permissions to 777 (rwx for all). This is directory outside your htdocs directory.
- Download go-pear.php (from http://go-pear.org) and install it somewhere inside htdocs.
- Navigate to go-pear.php through a browser.
- Setup the paths properly (use /vservers/username instead of ~). /usr/bin/php for php4 /usr/bin/php5 for php5
- Install
- Add ~/pear/bin to your PATH. If you're not sure how to do that, or don't care, you can type out the full path to pear (~/pear/bin/pear <command>).
- Run pear config-show and check to see if you need to change any paths. I had to change temp_dir, download_dir, and php_ini. Use pear config-set
- Set php_ini to ~/etc/php.ini
- Set temp_dir to ~/tmp/pear/temp
- Set download_dir to ~/tmp/pear/cache
- You should be set. Try pear install Mail to test it out.
- Use set_include_path(".:/vservers/username/pear/PEAR:/vservers/username/pear/lib") in your code to get access to the installed packages. Unfortunately, you can't set php directives in .htaccess (because it's CGI) and you can't edit ~/etc/php.ini (which I don't really understand).
- You should probably set the permissions for ~/pear to something lower
I believe that if you install pear under htdocs, you can use the pear web interface for your package management.
Installing this also installs pecl, but I have yet to get it to work properly. Still tries to install stuff to /usr/lib/php and says that I'm running php 4.3.2.