Is a shared installation of PEAR available on VPS servers, and if so what is the path...?
This is a discussion on PEAR access in the VPS & Dedicated forum
Is a shared installation of PEAR available on VPS servers, and if so what is the path...? ...
Is a shared installation of PEAR available on VPS servers, and if so what is the path...?
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
I just ran it on my site...
Location (which pear):
Version (pear -V):Code:/usr/local/bin/pear
I'm on SDX but VPS is likely to be the same, maybe, sort of...Code:PEAR Version: 1.4.9![]()
Last edited by Vin DSL; 02-07-2007 at 03: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.
My VPS didn't have PEAR installed by default, but the process to install it yourself is rather simple.
Adam Alkins
[website]
pear is installed on my VPS:
# pear -V
PEAR Version: 1.4.9
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.
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
pear install DB
That should do it. And you should be able to do
include "DB.php";
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?
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:
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.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
}
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
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.
Copyright © 2011 JaguarPC.com
Bookmarks