[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: PHP application packaging policy/best practice?



Le Mer 12 Janvier 2005 01:31, Matthew Palmer a écrit :
> [No Cc needed, as per list policy]
>
> On Tue, Jan 11, 2005 at 11:47:42PM +0100, Pierre Habouzit wrote:
> > > it's _quite_ true that you don't need to play with include_path.
> > > your library has to know it's installed
> > > into /usr/share/php/<app-or-library-name> and either :
> > >  * use some __FILE__ magic in its requires/includes
> > >  * already use requires on <app-or-library-name>/*php files
> > >
> > > And I assume a lots of intern libraries are do not know how to do
> > > that. even some that ARE packaged into
> > > /usr/share/php/<app-or-library-name>
> >
> > what a mess.
> > new try :
> >
> > It's only half-true that putting a lib into
> > /usr/share/php/<libname> is fine. the lib has to be able to manage
> > such a thing, and it's a requirement for a lib put into
> > /usr/share/php/<libname> to be able to live there, without having
> > to change anything in the include_path
> >
> > what I meant is that :
> >
> > libfile1.php live in /usr/share/php/mylib
> >
> > if libfile2.php has a :
> >
> > require 'libfile1.php'; anywhere, then it's not valid to package
> > that lib in /usr/share/php/mylib, because libfile2.php
> > NEEDS /usr/share/php/mylib to be in the include_path.
>
> So you patch libfile2.php to require_once 'mylib/libfile1.php'
> instead of just 'libfile1.php'.  We've learnt to do this with C
> include files, why can't people work out the same thing for PHP? 
> It's probably because of PHP's history as an easy, quick-hack
> language, that a lot of people with very little idea of even the
> basics of writing software have made an awful lot of really bad
> decisions...

sure, but in C, you find the problem really quick : one compilation and 
you know if pathes are OK.

in php, you cannot know ... you have to be really more careful.

> > I hope this was more understandable that the previous post
>
> It is a bit easier, so I've replied to this one instead of your
> first.

yeah, sorry, english is not my mother tongue, and after midnight, it's 
too difficult for me ;D
-- 
·O·  Pierre Habouzit
··O
OOO                                                http://www.madism.org

Attachment: pgpgQ3eAiFIJH.pgp
Description: PGP signature


Reply to: