Search code examples
phppear

PEAR/Digg2: PHP/Linux Installation Issue


I have a VPS running a VPS optimized Debian distro. I am very new to utilizing a VPS and have next to zero Linux background.

A little background to help: I went through and apt-get install pear which went through fine. I attempted to install the dependent services for the Digg api as such:

pear install HTTP_Request2 

This provided an error, I had to install it with:

pear install HTTP_Request2-alpha

Then I attempted:

pear install HTTP_OAuth

This provided the same error as above, I installed it eventually with:

pear install HTTP_OAuth-alpha

So I then successfully installed Digg2 with pear install Services_Digg2

Okay, background over. My issue is that it will not initiate the class as it says the file is not there. The PHP is as simple as this:

require_once 'Services/Digg2.php';
$api = new Services_Digg2;

I checked my include path as per the error in PHP:

Fatal error: require_once() [function.require]:
Failed opening required 'Services/Digg2.php' (include_path='/usr/share/php')
in /var/www/redacted1/data/www/redacted2/index.php on line 3

So I verified that the file was there in Terminal:

http://snapplr.com/tk9r

And I verified that the include path was proper via PHP_Info():

http://snapplr.com/dwk7 (sorry I can only post one hyperlink as I'm new)

The error remains. Hopefully my lengthy intro isn't a hassle and actually helps.

Any incite?

Thanks Jeff


Solution

  • To install a PEAR/PECL package that is in a state other than "stable", you have to specify the full spec for the package:

    pear install Services_Digg2-alpha #alpha state
    pecl install ssh2-0.11.2          #beta state
    

    PEAR also takes care of dependencies (usually, but I can confirm in that specific case that it does). You don't have to manually install them.

    Now that you have it installed, it should work like you did:

    include_once 'Services/Digg2.php'
    

    However, I'm a little concerned that your code shows include_once while the error message you have shows you are using require_once. This leads me to believe that the code you posted is not the actual code.