Re: PEAR / include path
| From: | Brent Cook | Date: | Sat, 05 Oct 2002 15:26:42 +0000 |
| Subject: | Re: PEAR / include path | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-2444@lists.php.net to get a copy of this message | ||
On Sat, 5 Oct 2002 zaphod@s4r.de wrote:
> [This followup was posted to php.pear.general and a copy was sent to the
> cited author.]
>
> In article <20021005044243.14515d73.paj@pearfr.org>, paj@pearfr.org
> says...
> > This point has been discussed already many times, sorry, you
> > have to normalize your source tree.
>
> The source tree of the software I develop is well designed and no
> problem. It will never conflict with PEAR. The problem is, that PEAR
> does not allow any other third-party-library beside it having a module
> tree, which is as poor as the one from PEAR.
>
> But when you have discussed this, why did you stick with this poor
> solution?
>
I'm not sure what you mean by this, but I feel that we have not been clear
enough explaining things. Lets start from the top, and perhaps things will
make more sense. In the future, let's archive messages like this, so that
we don't have threads like this every time someone is new to PEAR.
PEAR is designed to be integrated into PHP. As such, it must be easily
installed as a set of system-wide libraries, with no internal dependencies
on anything being installed at an absolute location. This same design
allows you to simply code:
include 'PEAR.php';
and have it work, no matter where PEAR is actually installed, or where
your code is installed relative to PEAR. The magic that makes this work is
that when PEAR is installed, its location should be automatically added to
the include_path in php.ini.
The bugbear (a sticky problem), is that there is not much value in using
the versions of PEAR supplied with any release of PHP to date. They are
too old and not in sync with what the PEAR developers are working on now.
This will be resolved with PHP 4.3, but this is the current state of
affairs. Please be patient and bear with us
To get a more recent version of PEAR, you can always use the pear
installer (http://pear.php.net/go-pear), but if you're designing a drop-in
application or can't install PEAR system wide (need a local installation),
then you have to fix-up the include_path magic yourself. It is a tradeoff
between working easily system-wide and being slightly more trouble working
locally.
Your choices for getting PEAR to work are hence:
1). use ini_set('include_path','.:path/to/my/pear/files') before including
any pear libraries.
2). do the same thing with a directory-wide .htaccess file. Just create a
file called .htaccess in the directory where your .php files are with the
line:
php_value include_path ".:/path/to/your/pear/files"
This method is nice if you don't want to change any of your php code, but
still help it to find your local installation of pear.
3). install PEAR globally. You need to either install php 4.3 cvs or run
http://pear.php.net/go-pear. It overwrites any old
installation of pear.
You would do well to verify that php.ini has pear's installation path in
its include_path.
I hope this helps you understand what is going on, what needs to be done,
and why PEAR is designed in such a way.
- Brent