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

Re: PHP application packaging policy/best practice?



On Wed, Jan 12, 2005 at 10:13:05AM +0100, Pierre Habouzit wrote:
> 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'm sure you'll get user feedback quickly enough... and a quick grep and
scan usually picks up most of the problems.

- Matt

Attachment: signature.asc
Description: Digital signature


Reply to: