Re: PEAR / include path
| From: | zaphod at s4r dot de | Date: | Mon, 07 Oct 2002 19:53:17 +0000 |
| Subject: | Re: PEAR / include path | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-2456@lists.php.net to get a copy of this message | ||
[This followup was posted to php.pear.general and a copy was sent to the
cited author.]
In article <Pine.LNX.4.44.0210050954280.9111-100000@stampy.hauschen>,
busterb@mail.utexas.edu says...
> 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';
OK, that was clear to me. The problem is, you do it in a way, that there
cannot be another system-wide library beside PEAR. The names of the
files in the main directory are so simple, that it is to be expected
that they might clash with other system-wide libraries. Since it is to
be expected, that PEAR is still growing and that other new files will
appear in the PEAR-directory, how will I know, that only updating
PHP/PEAR w'ont crash my system, which depends on other system-wide
libraries too. You cannot expect other developers of system-wide
libraries to behave more co-operative, if the developers of the most
important PHP-library don't do it.
include 'PEAR/PEAR.php';
would not be much more complicated, but solve most of the problem.
> 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.
This would also be no Problem with my suggestion.
> 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"
Why should I tie my hands if not necessary. If PEAR should be a system-
wide library, you should not even think, to make such suggestions.
> 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.
No. This is a very ugly hack and it does not help at all. If I use 2
files with two different library-files to be included, but which share
the same filename, I have to put them in seperate directories. In
general I use directories for grouping my files and not to fix problems
in a system-wide library.
> 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.
And here the cat bites its tail - PEAR is not designed to do this as I
stated several times.
> I hope this helps you understand what is going on, what needs to be done,
> and why PEAR is designed in such a way.
It is very clear to understand what's going on, but either you nor
Pierre-Alain found a good reason to tell me, why PEAR is designed this
way. As far as I can understand, you leave the problems you should solve
as a library-developer to the user of your library.
I am not surprised, that this issue rises up again and again, because
the way you deal with the include-path is an error in your design or at
least very short-sighted.
Regards
Thomas