Just following up on Eddo88’s terrific post on installing PEAR: If you are a bit new to *nix, PHP, etc. (like me), you might want some stuff spelled out even more explicitly. You probably don’t need to read this if you have a thorough understanding of Linux/Unix already.
I just spent a considerable amount of time working on this stuff, and got it working, and I had no idea what I was doing when I started out.
During installation, you must (AFAIK) change option #1, the install-prefix, to the equivalent of ‘/home/yourusername/php/’ (with ‘php’ being the name of the directory you created to download/install PEAR into).
I could not get part of step 6 to work: “export ~/bin:$PATH” kept returning “not a valid identifier”. I’m sure it’s obvious to more experienced users why, but I couldn’t figure it out, no matter how many variations I tried. However, I think this problem was rendered moot by performing the rest of Eddo’s step 6. You have to list the path to PEAR in your .bash_profile, so PHP knows where to find it. Your .bash_profile is in your home directory, even if you can’t see it. (Try ‘ls -a’ to see it.) Edit this file using any old text editor. (You can type ‘pico .bash_profile’ to edit it.)
Once you’ve got it open, add in a line like this:
Save the file using ctl-O.
As Eddo says in step 7, you next have to modify your .htaccess file so php knows where to look for your PEAR include files. Go into the base directory of your website and do ‘pico .htaccess’. Add the line suggested by Eddo, making sure the directory you add is the like ‘.:home/yourusername/php’ [again, where ‘php’ is the directory you created]. If you follow the rest of the steps below and it doesn’t work, edit this line so that it has that weird directory name you sometimes see (instead of ‘home/yourusername’ it goes ‘home/.strangewordsadded/yourusername’). I did this and it worked.
Finally, depending on what your scripts are doing (I think), it seems like you may have better luck if you name the file containing your scripts with a .pcgi extension instead of a .php extension. If you don’t, you may get the ‘open_dir restriction in effect’ message. (I did.) For an explanation of why changing it to .pcgi works, see:
The PEAR packages I’m using are the XML_RSS and XML_Tree packages. For these and other packages, you may need to edit their scripts so that the ‘require’ functions go to the correct relative path.
In any case, good luck – I hope this (overly?) explicit post saves you some frustration. If I made any errors in my comments, which is quite possible, please reply to this post to clarify.