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

Re: PHP application packaging policy/best practice?



On Wed, 12 Jan 2005 10:16:43 +0100, Pierre Habouzit
<pierre.habouzit@m4x.org> wrote:
> Le Mer 12 Janvier 2005 01:31, Matthew Palmer a écrit :
> > So you patch libfile2.php to require_once 'mylib/libfile1.php'
> > instead of just 'libfile1.php'.
> 
> oh and btw, the suggestion I did is better (IMHO) :
> 
> replace require_once 'libfile.php'; with
> 
> require dirname(__FILE__).'/'.'libfile1.php';

So far, I have preferred to use files which include
@ETCDIR@/package/package.cfg. In package.cfg, I define PHPDIR, LIBDIR,
DATADIR using autotools. That way, after autoconfiguring, all PHP
scripts have lines like

require_once '/etc/appname/appname.cfg';
require_once LIBDIR.'/dbwrapper.plib';
require_once LIBDIR.'/lib1.plib';
etc.

and /etc/appname/appname.cfg contains data like

define('LIBDIR', '/usr/share/appname/lib');
define('PHPDIR','/usr/share/appname/php'); 
define('DATADIR','/usr/lib/appname');

Unlike the C community, PHP developers cannot simply assume that
include files will be in our path, since that would require an
override / settings-update for each application. The other suggestion
so create a branch under /usr/share/php/appname is also a good one;
however that might lead to name conflicts as pointed out earlier.

-Kees
-- 
Kees Leune <kees@leune.org>



Reply to: