httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <>
Subject Re: PHP testing - problem with php libraries loading
Date Sun, 20 Nov 2005 01:36:25 GMT
cc'ing chris :)

> I think a line in the t/conf/php.ini:
> 	extension_dir = "./"
> means that php seeks libraries in the current
> directory, while those 
> libraries are in the /usr/lib/php4/. 

hmm, could be.  chris would know better.

> Thereby I have 2
> questions:
> 1) Why it is necessary to have a special php.ini for
> testing?

for the same reason that Apache-Test maintains all its own configuration
files, really - consistency, principle of least surprise, and so on.  think
of it like this...

say you have code that works one system and doesn't work on another.  the
problem turns out to be that your php.ini file contains a crucial
difference, but one you didn't think was crucial.  if your tests relied on
the installed php.ini file then you'd have the exact same problem on each
box when running the tests, on one box it would fail and on one box it would
pass.  this is Very Bad from a testing point of view - tests should create a
very specific environment in which to exercise your code, one where all the
variables are known.

using our own php.ini file (and own httpd.conf, etc) means that the
described circumstance would never happen - the tests would pass on both
systems letting you know immediately that your production environment is
_not_ the same as your testing environment.  and that is Good from a testing
point of view.

> 2) How can I test (in a sane manner) php code with
> functions from 
> dynamic libraries?

I don't know the specifics, but to alter any php.ini setting you would
create t/conf/ and use a php variable to override the default
settings in php.ini

> I've tried to copy in the "current
> directory", in all
> meanings of "current" which I could imagine but
> without any success.
> I've successfully tried to modify the
> Apache::TestConfigPHP 
> so that it generates now
> 'extension_dir="/usr/lib/php4/"',
> but I don't think it is a good solving...

no, anything you need to override you can do locally from t/,
such as

<IfModule @PHP_MODULE>
  php_extension_dir /usr/lib/php4/

or somesuch - I'm not really a php guy :)

chris has links to the sample tarball where you can see tricks like this in
action.  unfortunately we haven't had the free tuits to document it as well
as we would have liked.  but then again, nobody seemed to be using the php
side of things but us.  so, welcome - we hope you like it :)


View raw message