Installing PEAR on Site5 server (or any shared host)

[PEAR] is a library of really useful PHP stuff that deals with everything from simple database management to HTTPRequest stuffs.

[Site5] is a hosting company that have good deals for decent space and tools.

Site5 has some PEAR libraries installed (you can find out which by typing: pear list) but not very many and, more importantly, not the one I wanted.

So, given that I have 55Gb of space to use, I thought I’d have a crack at installing it myself :)

So I started from this [Site5 forum thread], and tried to grab the [PEAR package] but due to the jailshell restrictions of SSH logins you can’t do wget :(

Once I’d FTP’d it onto the host I found that PHP5 didn’t appear to have a binary I could see, but one support request later and that was fixed.

So then I go and do:
php5 go-pear.phar

And nothing happens, I press return and get:

bash-3.00$ /usr/local/php5/bin/php5 go-pear.phar -help

X-Powered-By: PHP/5.2.1
Content-type: text/html

Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type ‘all’ to change all of them or simply press Enter to
accept these locations.

1. Installation base ($prefix) : /home/uname/pear
2. Temporary directory for processing : /tmp/pear/install
3. Temporary directory for downloads : /tmp/pear/install
4. Binaries directory : /home/uname/pear/bin
5. PHP code directory ($php_dir) : /home/uname/pear/share/pear
6. Documentation directory : /home/uname/pear/docs
7. Data directory : /home/uname/pear/data
8. User-modifiable configuration files directory : /home/uname/pear/cfg
9. Public Web Files directory : /home/uname/pear/www
10. Tests directory : /home/uname/pear/tests
11. Name of configuration file : /home/uname/.pearrc

1-11, ‘all’ or Enter to continue: Unable to create Temporary directory for processing /tmp/pear/install.
Run this script as root or pick another location.

For whatever reason I can’t write to the /tmp directory – maybe cos someone else has done it and I don’t have user rights to overwrite it.

Right, now what this really seems to mean is “you’re going to have to do this blind!”

So, run the script again, then:

  • type ‘2’
  • press return
  • type the new path
  • press return
  • type ‘3’
  • press return
  • type the new path
  • press return
  • finally press return

And voilà, off it goes :)

For me this script never technically finished, so keep your eye on the output and kill it when you think it’s done.