Web Hosting Forums

Page 1 of 2 1 2 LastLast
Results 1 to 15 of 18

This is a discussion on PEAR access in the Hosting Talk & Chit-chat forum
Is a shared installation of PEAR available on VPS servers, and if so what is the path...? ...

  1. #1
    Loyal Client
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    135

    PEAR access

    Is a shared installation of PEAR available on VPS servers, and if so what is the path...?

  2. #2
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    5,884
    Shared in the sense of shared among other VPS instances on your node or shared as in shared among users of your VPS? If the former then no, because your VPS is really its own independent server. If the latter, it probably depends on your server setup, PHP version, control panel, and things like that. Check /lib/php and /usr/lib/php, as those are the most common places to find server-wide PEAR installs. Also do a phpinfo() and check for the include_path that is defined for your setup to see what you can find.

    If you can't find a pear installation that way, it is really easy to install PEAR yourself. You just download the script from go-pear.org and run it on your server (as root if you want a server-wide install) and then follow the prompts. There are both command line and web-based interfaces to the go-pear script (both from the same script), but I'd recommend the command line version (its faster and a little less buggy).

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  3. #3
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,661
    I just ran it on my site...

    Location (which pear):
    Code:
    /usr/local/bin/pear
    Version (pear -V):
    Code:
    PEAR Version: 1.4.9
    I'm on SDX but VPS is likely to be the same, maybe, sort of...
    Last edited by Vin DSL; 02-07-2007 at 04:41 PM.
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL 2010

  4. #4
    R45
    R45 is offline
    Loyal Client R45's Avatar
    Join Date
    Mar 2002
    Location
    Trinidad and Tobago
    Posts
    72
    My VPS didn't have PEAR installed by default, but the process to install it yourself is rather simple.
    Adam Alkins
    [website]

  5. #5
    all about nothing! Frank Broughton's Avatar
    Join Date
    Jan 2006
    Posts
    2,237
    pear is installed on my VPS:

    # pear -V
    PEAR Version: 1.4.9

  6. #6
    take it easy ... arianetwork's Avatar
    Join Date
    Mar 2006
    Location
    Hungry
    Posts
    110
    what is pear?

  7. #7
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,661
    Quote Originally Posted by arianetwork View Post
    what is pear?
    http://pear.php.net/manual/en/about-pear.php
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL 2010

  8. #8
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    5,884
    Quote Originally Posted by Vin DSL View Post
    I just ran it on my site...

    Location (which pear):
    Code:
    /usr/local/bin/pear
    That's the pear package manager program, wich is usually in a different location than the actual packages it installs...but the presence of that program would imply that pear is installed and the libraries are *somewhere* on the server...

    You need to know where the libraries are in order to make use of them in PHP. Generally speaking this is done by the server admin via an include_path setting in php.ini, but on VPS the admin is the client.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  9. #9
    Loyal Client
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    135
    Quote Originally Posted by jason View Post
    That's the pear package manager program, wich is usually in a different location than the actual packages it installs...but the presence of that program would imply that pear is installed and the libraries are *somewhere* on the server...
    Okay - where?

    There are some PEAR files at /usr/local/bin/pear, but I need PEARs DB methods, which I don't see.

  10. #10
    CTO JPC-Masood's Avatar
    Join Date
    Aug 2002
    Location
    Jaguar Servers
    Posts
    1,916
    pear install DB

    That should do it. And you should be able to do

    include "DB.php";
    [COLOR="DarkRed"]Masood N. [/COLOR] | [COLOR="Red"]Chief Technical Officer[/COLOR][SIZE="3"] JaguarPC.com[/SIZE]

  11. #11
    Loyal Client
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    135
    Quote Originally Posted by masood View Post
    pear install DB

    That should do it. And you should be able to do

    include "DB.php";
    Can I have an idiot's guide please? I am not a command line kind of guy. I use WinSCP3.

  12. #12
    Loyal Client
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    135
    Okay, I think I've worked that bit out. Now I'm getting the following error:

    Fatal error: Call to undefined method DB_Error::fetchRow() in...

    I think this is PEAR related - is that right?

  13. #13
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    5,884
    For the "idiots guide" try typing "pear help" at the command line, which will give you a list of commands that you can send to the pear package manager. From there try "pear help <command>" to get the instructions for using a specific command. For example, "pear help install" will tell you everyrhing you need to know about installing packages.

    As for your error, it looks as though your query did not return a successful result. Instead it returned a DB_Error object. Your code is not checking for the error state and is trying to fetch rows of data from the DB_Error object.

    Try something like this:
    PHP Code:
    $db DB::connect($dsn);
    $result =& $db->query('SOME SQL STATEMENT');
    if(
    PEAR::isError($result)) {
        die(
    $result->getMsg());
    }
    foreach(
    $result->fetchRow() as $row) {
       
    //do whatever with your result here

    Many PEAR methods return PEAR::Error objects when errors occur. The error object's getMsg() method will give you a text description of the problem. if(PEAR::isError($obj)) is an easy way to check for an error state. In the example above, the script will print the error message to the browser and then exit.

    You can also get a lot of other info out of the error object. Try doing a print_r($obj) to see lots of info to help you debug.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  14. #14
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,661
    LoL!

    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL 2010

  15. #15
    Loyal Client
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    135
    Quote Originally Posted by jason View Post

    PHP Code:
    if(PEAR::isError($result)) {
        die(
    $result->getMsg());

    --Jason
    After a little confusion I realised this should actually be $result->getMessage.

    Thanks a lot for your excellent help.
    Last edited by uprightdog; 02-09-2007 at 03:59 AM.

Page 1 of 2 1 2 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •