Re: Access to Pear

From: Date: Tue, 28 Jan 2003 04:16:01 +0000
Subject: Re: Access to Pear
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-133342@lists.php.net to get a copy of this message
You could download the pear files from the pear CVS to somewhere within your programs path. If your web files are in (using a linux example) /home/foo/public_html then just change to that directory and checkout the files from CVS. This also gives you the luxury of keeping the pear files uptodate yourself (cd pear; cvs update). Information on getting pear from the CVS can be found here http://www.onlamp.com/lpt/a/882 (scroll down). Another option would be to keep everything they way it is and use a full path to the include files. You can set the include path in a main settings file somewhere: define('DIR_PEAR', '/apache/php/pear'); include(DIR_PEAR . 'DB.php'); Of course you would need to have the settings file included in all your scripts (but this is a common thing for larger apps). If you want it to dynamically switch depending on windows or linux, using full paths, you could try something like (taken from pear DB, if I remember right - using a shared settings file as well): // try windows define('ROOT_PATH_DELIMITER', 'C:'); define('SMART_PATH_DELIMITER', (substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/' ); define('DIR_PEAR', ROOT_PATH_DELIMITER . SMART_PATH_DELIMITER . 'apache' . SMART_PATH_DELIMITER . 'php' . SMART_PATH_DELIMITER . 'pear'); include(DIR_PEAR . SMART_PATH_DELIMITER . 'DB.php'); Then the only thing you have to change from windows to linux is the ROOT_PATH_DELIMITER (comment it out). I did this quickly so not sure if it works. Play around - I'm sure you will find something you can work with. OR you can manually set your include path at the start of your app: ini_set('include_path', '.:..:../..:/apache/php/pear'); // searches through ./foo.inc, ../foo.inc, ../../foo.inc, /apache/php/pear/foo.inc good luck Quoting Warren Vail <warren@vailtech.net>: > > I know how to load extensions if they are not included in PHP.ini (dl > function), but how do I gain access to PEAR? > > I can see the directory /apache/php/pear/ on my test machine, but when I try > to reference via > > include_once("DB.php"); > > not found on include list error,,,,, can I dynamically change include list, > and what kind of security hole would that represent? my test machine is > windows, and my production machine is Redhat Linux, so I need to find a way > to gain access to pear in both environments. > > Warren Vail > warren@vailtech.net > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#133342) next »