Getting an HTTP_Request class was pissing me off. So it seems like you can’t install PECL classes on your php install because of rights issues on a shared hosting environment.
BUT, you can get PEAR classes installed through the cPanel, using the PHP PEAR Packages link. I was adding the HTTP_Request package (HTTP_Request2 won’t install because there is no stable release as of yet).
But even after the install, the classes could not be found. Like when I did require_once(‘HTTP/Request.php’) I was getting the classic not found warning and error:
Warning: include(HTTP/Request.php) [function.include]: failed to open stream: No such file or directory
Warning: include() [function.include]: Failed opening ‘HTTP/Request.php’ for inclusion
Fatal error: Class ‘HTTP_Request’ not found
You have to edit the php.ini (or ini_set the include_path ) to include :/home/yourusername/php, or in my case the home directory is now home3 for some reason, with some weird aliasing allowing for home I think. The PEAR packages install to /home/yourusername/php, so this needs to be added to the include path.
If you still get:
PHP Fatal error: main(): Failed opening required ‘PEAR.php’
Then your include_path may be missing :/usr/lib/php, this is the main (not your local user) php lib folder that, I think, has the main PEAR files (The ones that your local PEAR package installs like HTTP_Request will be calling). So when you install a PEAR package via the cPanel, it puts them in /home/yourusername/php, and those files will need to know about the main PEAR install in /usr/lib/php by having /usr/lib/php in the include path.