Re: PEAR usage
| From: | Brent Cook | Date: | Sun, 26 May 2002 10:19:28 +0000 |
| Subject: | Re: PEAR usage | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6425@lists.php.net to get a copy of this message | ||
On Sun, 26 May 2002, Dan Allen wrote:
> I have been talking to leading developers of several projects,
> including phpBB about using PEAR as the database abstraction layer
> amoung other things...I just wanted to report back to you the
> feedback I got and the reason the answer is still NO.
>
> PEAR needs to be able to work without having the libraries in the
> include path (since it is not possible to modify this setting at
> runtime). The reason for this is that many webhosts have not yet
> become acquainted with PEAR and therefore do not have it installed.
You can install pear quite simply, even with an unprivledged user account
with php 4.06 running in safe mode (which doesn't have the
safe_mode_includes directive).
First, write a simple script to copy enough of the the pear files that I
would need to have a minimal install. Just a bunch of copy -r's. Copy
these files to the normal include directory used for a web project.
Then, whenever you need pear, just use these two lines at the top of a
script:
$include_path = './include/pear:';
ini_set('include_path', $include_path.ini_get('include_path'));
Then, you will be able to use PEAR as if you had it installed globally.
This is the script I used to create the mini installation. It assumes that
you have checked out the php4/pear and pear modules from CVS. Yes, it
ignores the package.xml files, but I can easily read those and change the
script myself. It would be nice to have some sort of 'mini-pear' utility
that worked like this script, only more nicely.
#!/bin/sh
PHPSRC="./php4/pear"
PEARSRC="./pear"
DEST="../public_html/include/pear"
FILES="Archive/ Console/ Crypt/ Date/ File/ HTML/ HTTP/ Mail/ Net/ OS/ PEAR/ Schedule/ XML/
CMD.php PEAR.php HTTP.php Mail.php"
for i in $FILES; do
cp -R $PHPSRC/$i $DEST/$i;
done
cp -R $PEARSRC/DB/* $DEST
cp -R $PEARSRC/HTML_QuickForm/* $DEST/HTML
cp -R $PEARSRC/File/* $DEST
cp -R $PEARSRC/MDB $DEST
find $DEST -name "CVS" | xargs rm -fr
find $DEST -name ".cvsignore" | xargs rm -fr
find $DEST -name "tests" | xargs rm -fr
Happy PEARing,
Brent