OS-specific instructions follow; see below for general information about switches and environment variables.
Install, via port, libxml2, libxslt, libiconv, gd2 (+no_x11), freetype, sqlite3.
Download from:
<http://uk.php.net/get/php-5.3.0.tar.gz/from/a/mirror>
Configure with:
$ export PHP_ROOT=/usr/local/php-5.x.y
$ ./configure --prefix=$PHP_ROOT \
--enable-fastcgi --with-xsl=/Ports --with-libxml-dir=/Ports \
--with-gd=/Ports --with-jpeg-dir=/Ports --with-pdo-sqlite=/Ports \
--without-sqlite --without-sqlite3 --with-freetype-dir=/Ports \
--with-ttf=/Ports --enable-calendar --with-zlib=/Ports --with-iconv \
--with-openssl --enable-discard-path --enable-bcmath --with-curl
$ make
$ make install
$ cp php.ini-recommended $PHP_ROOT/lib/php.ini
$ jed $PHP_ROOT/lib/php.ini # set extension_dir to $PHP_ROOT/php-config --extension-dir
OS-specific notes (see below for general notes):
This doesn't install the MySQL library, because it's a pain. If you want MySQL, then add:
--with-mysql=$MYSQL --with-pdo-mysql=$MYSQL
Where $MYSQL is where the MySQL client libraries and header files are installed.
(e.g. $HOME/local or /usr--you can't install MySQL into separate
"binary" and "shared" directories.) These are installed as part of the MySQL
server distribution, but if you only want to install the client libraries,
download the source and configure with --without-server. Do not install
the library itself and header files into separate directories (i.e. do not
use --exec-prefix)--the PHP configure script can't deal with these being
in separate directories.
If compiling with some versions of OS X (10.5.0, 10.5.4, 10.5.5 and 10.5.6 seem to
be affected, at least), replace /usr/include/iconv.h with MacPorts' version
before configuring, to prevent iconv link errors.
Install the likely module suspects:
libjpeg62-dev libxslt1-dev libcurl4-openssl-dev libssl-dev
libsqlite3-dev libgd2-noxpm libpng12-dev libfreetype6-dev
libmysqlclient15-dev # optional?
Download from:
<http://uk.php.net/get/php-5.3.0.tar.gz/from/this/mirror>
Configure with:
$ export PHP_ROOT=/usr/local/php-5.x.y
# For PHP 5.3.0
$ ./configure --prefix=$PHP_ROOT --with-xsl=/usr \
--with-libxml-dir=/usr --with-gd --with-pdo-sqlite=/usr \
--without-sqlite3 --without-sqlite --with-freetype-dir=/usr \
--enable-calendar --with-zlib --with-iconv --with-openssl \
--with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --enable-bcmath \
--disable-xmlreader --disable-xmlreader --enable-mbstring \
--without-pear --with-config-file-scan-dir=/usr/local/etc/php.d
--with-mysql --with-pdo-mysql # optional?
# For PHP 5.2.x
$ ./configure --prefix=$PHP_ROOT \
--enable-fastcgi --with-xsl=/usr --with-libxml-dir=/usr \
--with-gd --with-pdo-sqlite=/usr --without-sqlite \
--with-freetype-dir=/usr --with-ttf=/usr --enable-calendar \
--with-zlib --with-iconv --with-openssl --enable-discard-path \
--with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-mysql \
--with-pdo-mysql --enable-bcmath --with-curl
$ make
$ make install
# For PHP 5.3.0
$ cp php.ini-development $PHP_ROOT/lib/php.ini
# or
$ cp php.ini-production $PHP_ROOT/lib/php.ini
# For PHP 5.2.x
$ cp php.ini-recommended $PHP_ROOT/lib/php.ini
$ jed $PHP_ROOT/lib/php.ini # set extension_dir to $PHP_ROOT/php-config --extension-dir
OS-specific notes (see below for general notes):
--with-jpeg-dir and --with--dir
directory parameters specify the location of their respective libraries,
not the root. (I don't know why either of these is necessary; for some
reason the bundled GD doesn't come with JPEG and PNG libraries.)Install libxml2, libxslt, gd, libjpeg, libpng, zlib (configure zlib with --shared, otherwise you'll get link errors), then:
$ lconfigure --with-apxs2=$LOCAL/bin/apxs \
--with-xsl=$LOCAL --with-libxml-dir=$LOCAL --with-gd=$LOCAL \
--with-jpeg-dir=$LOCAL --with-png-dir=$LOCAL --with-zlib-dir=$LOCAL \
--enable-debug --with-mysql=/usr/local/mysql --enable-calendar
(Might also need to ln -s $HOME/local/include to $LOCAL/include--one
of the dependencies couldn't find the include files from the
architecture-independent directory.)
Get Apache running first.
Download the "ZIP package".
Add something like the following to httpd.conf:
LoadModule php5module "C:/server/php-5.2.4/php5apache22.dll" PHPIniDir "c:/server/php-5.2.4"
(Probably:) Copy php.ini-recommended to php.ini, and tweak as required. (If enabling modules, be sure to set extension_dir!)
Add your PHP directory to PATH, so that various supporting DLLs (e.g. libmysql.dll, libeay32.dll) can be loaded automatically. (How to modify the PATH.)
(optional) Install the Zend debugger
i. Download site. (The "cygwin_nt-i386" version works fine with the regular Windows binaries.)
i. Put the ZendDebugger.dll from the 52x_comp (thread-safe) directory into your PHP extensions directory. (Probably C:\server\php-5.2.4\ext.)
i. Modify php.ini, as described in the README.txt.
i. Restart Apache. A phpinfo() call should mention the debugger.
i. (After all this, couldn't get breakpoints working.)
(optional) Install the Xdebug debugger
i. Download site.
i. Put the php_xdebug-2.0.0-5.2.2.dll into the PHP extensions directory. (Probably C:\server\php-5.2.4\ext.)
i. Add the following to php.ini:
zend_extension_ts=c:/server/php-5.2.4/ext/php_xdebug-2.0.0-5.2.2.dll
xdebug.remote_enable = On
xdebug.remote_host=10.171.99.124
i. Restart Apache. A phpinfo() call should mention the debugger.
i. More info
$PHP_ROOT specifies the root of your PHP installation and will probably be something like
$ export PHP_ROOT=$HOME/local-linux/php-5.2.6
or
$ export PHP_ROOT=/usr/local/php-5.3.0
After PHP is installed with make install, $PHP_ROOT/bin/php will be your PHP binary.
You may want to remove --without-pear if you need PEAR.
You can also drop the --without-sqlite to use the bundled
sqlite3. (In this case you also don't need to install sqlite3 via
port.)
The directory specified by --prefix determines where PHP is installed. The
php and php-cgi binaries can be safely moved to other locations, however a
few scripts have this location hardcoded, and won't work if the binaries are
moved (phpize, pear).
--enable-discard-path supposedly eliminates a security
problem.
--with-curl provides curl support. This is potentially
unnecessary. (Zend_Http_Client does not use
it.)
--enable-pear and --disable-xml are incompatible: pear requires
xml.
--enable-bcmath.--enable-simplexml.--enable-mbstring is needed for mb_encoding_convert. Is this
really necessary? It seems to make the PHP binary a whole lot bigger!
(See below for instructions for specific extensions.)
Configure, build and install:
$ $PHP_ROOT/bin/phpize
$ ./configure --with-php-config=$PHP_ROOT/bin/php-config
$ make
$ mkdir -p $($PHP_ROOT/bin/php-config --extension-dir)
$ cp modules/*.so $($PHP_ROOT/bin/php-config --extension-dir)
Or, in one line:
$ $PHP_ROOT/bin/phpize && \
./configure --with-php-config=$PHP_ROOT/bin/php-config && \
make && \
mkdir -p $($PHP_ROOT/bin/php-config --extension-dir) && \
cp modules/*.so $($PHP_ROOT/bin/php-config --extension-dir)
Modify php.ini files as appropriate, adding the line
extension=new_module.so
You do not need to specify the full pathname. At a minimum, you'll probably want to modify:
$ $EDITOR $PHP_ROOT/lib/php.ini
Some common modules:
apc.php that provides some cache statistics
that you may wish to install on your server. memcache.php that provides some
cache statistics that you may wish to install on your server. Unlike
apc.php it includes its own HTTP authentication system, so if you're
adding this to a directory that already password protected (by Apache,
say), you'll probably want to remove this.Download from:
<http://www.xdebug.org/download.php>
Configure, compile and install as above.
When editing php.ini and add the line:
zend_extension=/full/path/xdebug.so
(Xdebug itself can actually be installed anywhere on the filesystem.)
Download and install libmemcached (not the same as the libmemcache-dev
Debian package!):
<http://tangent.org/552/libmemcached.html>
Download:
<http://pecl.php.net/package/memcached/>
Configure, make and install as above.
Install libxml2, libxslt, then:
$ lconfigure --enable-fastcgi --with-xsl=$LOCAL \
--with-libxml-dir=$LOCAL --with-gd --with-ttf=/usr \
--with-freetype-dir=/usr --enable-calendar
(Uses their gd, ttf, freetype, etc.)
To install:
$ make install
Stripping the binary will save a lot of memory (optional):
$ strip `which php`
Note that this doesn't install the full command-line version (cli). To get that you need to
$ make install-cli
however the command-line version has the same filename--this installs a new "php" binary over the top of your old one. (? I think this changed around 5.2.3.)
To get Dreamhost's Apache to run your php under FastCGI, you need
these lines in your .htaccess:
# Remove the default action for *.php files.
RemoveHandler php
# For some reason the following really does need to be called
# dispatch.fcgi. The contents of dispatch.fcgi:
#
# #!/usr/bin/env bash
#
# exec ./php
#
# DOCUMENT_ROOT/cgi is symlinked to $LOCAL/bin. Dreamhost's config
# seems to have already configured fastcgi-script for *.fcgi.
Action php-fastcgi /cgi/dispatch.fcgi
AddType php-fastcgi html
AddType php-fastcgi php
http://php.net/reserved.variables
Use "." for concatenation; see the PHP manual for more.
Use "break".
http://php.net/manual/en/language.control-structures.php
Includes the alternative syntax.
if (!preg_match("/^foo/", "some string")) {
# ...
}
This doesn't work in PHP:
$sth = odbc_prepare($dbh, $sql);
foreach (...) {
$res = odbc_execute($sth, $arg);
...
}
(The prepared statement gets mashed somewhere--move the odbc_prepare()
into the loop...)
True! You need to use PDO.
i.e. the equivalent of PERL5LIB, PYTHONPATH,
RUBYLIB, etc.:
$ php -d include_path=$PHPLIB
This doesn't seem to be possible in PHP; the best way is to do something like:
Foo::$bar = "hullo, world"!;
class Foo {
public static $bar;
}
class Foo {
static $bar = null;
function quux() {
return self::$bar;
}
}
Give the variable a name that ends in "[]". If there are multiple keys with the same value, and the keys end in "[]", PHP creates an array of values for that value. i.e. if the HTML looks like
<select multiple name="beer[]">
<option value="warthog">Warthog</option>
<option value="guinness">Guinness</option>
<option value="stuttgarter">Stuttgarter</option>
</select>
and the user selects multiple beers, then
gettype($_REQUEST["beer"]) == "array"
See:
http://www.php.net/variables.external
Use call_user_func_array():
call_user_func_array("foo", array(1, 2, 3));
Note that this can also be used to call a method:
call_user_func_array(array($obj, $method), array(1, 2, 3));
date("Y-m-d H:i:s")
If you need to convert e.g. ’ to ’ do something like:
$table = array(
'Á' => 'Á',
'á' => 'á',
...
);
$s = strtr($s, $table);
The Wikipedia source contains an entity conversion table.
@ as a prefix suppresses any warning or error that might otherwise be
emitted.
Note that this works with both method calls and assignments:
$res = @$doc->loadXML($string);
$foo = @$GET_["foo"];
(Other error handling functions.)
Use
[mb_encode_numericentity](http://php.net/manual/en/function.mb-encode-numericentity.php). The exact arguments seem somewhat hard to come by; this is my current best effort:
$map = array(
0x0000, 0x001f, 0, 0xffff,
0x0026, 0x0026, 0, 0xffff, // &
0x003c, 0x003c, 0, 0xffff, // <
0x003e, 0x003e, 0, 0xffff, // >
0x007f, 0xffff, 0, 0xffff
);
mb_encode_numericentity($s, $map, 'utf-8');
error_log() quotes backlashesecho("\\hello\\") -> \hello\
error_log("\\hello\\") -> \\hello\\
odbc_execute($sth, $a);
If any of the element of $a begin and end with a single quote, the bit
in between is interpreted as a filename, the contents of which are
inserted.
Very strange arguments in php.ini:
; Define the probability that the 'garbage collection' process is started
; on every session initialization.
; The probability is calculated by using gc_probability/gc_divisor,
; e.g. 1/100 means there is a 1% chance that the GC process starts
; on each request.
session.gc_probability = 1
session.gc_divisor = 1000
Include is a "special language construct", which means that these two things are not equivalent:
if ($condition)
include $this;
else
include $that;
and
if ($condition) {
include $this;
} else {
include $that;
}
array_filter() and array_map() take their arguments in opposite order:
array array_filter ( array input [, callback callback] )
array array_map ( callback callback, array arr1 [, array ...] )
imageepsbbox returns an array of four values giving the bottom left
and top right coordinates of a given string.
imagettfbbox returns an array of eight values, giving the coordinates
of all four corners of a given string.
parse_str() parses--guess what?--a query string. (Also, the inverse
is http_build_query().)
More unfortunately-named pairs:
htmlspecialchars()/htmlspecialchars_decode()
htmlentities()/html_entity_decode()
The insanity of:
isset($foo)
empty($foo)
is_null($foo)
$foo
(Could possibly add array_key_exists() and defined() to this list too.)
Note also that empty(trim($foo)) doesn't work--the argument to empty()
needs to be a variable, not an expression.
See also:
http://php.net/types.comparisons
include() is relative to the original file, not the included file.
See:
http://bugs.php.net/bug.php?id=9673
You can include() relative to the included file with:
include(dirname(__FILENAME__) . "/../$filename");
Like this:
echo "This works: {$obj->values[3]->name}";
See:
http://php.net/manual/en/language.types.string.php#language.types.string.parsing.complex
parent::__construct(...);
Comment describing how to extend PDOStatement (not tested).
The operators "+", "-" and "." have the same precedence. This means that e.g.
error_log("elapsed time = " . $t1 - $t0)
doesn't do what you expect--it evaluates as
error_log(("elapsed time = " . $t1) - $t0)
(This is the same as Perl.)
(The full operator precedence table. Note the Perl-like low precedence "and", "xor", "or".)
parse_ini_file() returns unexpected results"true", "on", "yes", "1" are converted to "1" (the number 1, as a string).
"false", "off", "no" are converted to "" (the empty string).
"0" is not converted, and is returned as "0" (the number 0, as a string).
Because of this behaviour, and the way values are compared, when
checking for a boolean value via parse_ini_file() (i.e. whether some
setting is true or false), you should simply use if ($value) { ... }
instead of trying to be clever with if ($value == true) { ... },
etc.
$data = array(array(), array());
print_r($data);
foreach ($data as $d) {
$d[0] = "qqq";
}
print_r($data);
0.0 !== 0
0.0 == 0, but 0.0 !== 0. For some reason this isn't listed in the type
comparison table.
print_r(), var_export() and the like output a line per key => value
pair. If you want a few key => value pairs per line, try something
like the following ($table is the original array):
$a = array();
foreach ($table as $k => $v) {
$a[] = sprintf("%11s => %9s,", "'{$k}'", "'{$v}'");
}
for ($i = 0; $i < count($a); $i++) {
echo $a[$i], " ";
if (($i + 1) % 5 === 0) {
echo "\n";
}
}
(Quick hack, doesn't handle ' in either the key or value, for example.)
__call() within functionsThis doesn't work, and is a bug, at least as of PHP 5.2.5.
It can be fixed by applying a patch and re-compiling.
libgcrypt errorThis happens if you're building with XSL (--with-xsl) and libgcrypt
isn't available. You need to install both libgcrypt and its
dependency libgpg-error:
(Or add --without-xsl to your ./configure line.)
(Followed by "The specified module could not be found", and where XXX actually exists.)
PHP seems to produce this error fairly indiscriminately if the module can't
be loaded for any reason at all, not just in the case where the apparently
missing module doesn't exist on the filesystem. For example, it can happen
if you neglect to include a dependency of the named module, such as if you
load php_pdo_oci.dll without loading php_pdo.dll.
It can also happen if an external dependency can't be found (database
DLLs?) or the wrong version is being found (Apache DLLs? Windows
DLLs?). (The PATH is searched for DLLs, but DLLs can come from other
places as well, such as Apache's bin directory.)
If you're having trouble with php_mysql.dll, make sure that
libmySQL.dll can be found.
If you're having trouble with php_pdo_oci.dll, make sure the Oracle
client libraries can be found.
If you're having trouble with php_openssl.dll, make sure libeay32.dll
can be found, and that the wrong version (Apache's?) isn't being
found.
Username and password are specified as follows:
$dbh = new PDO($dsn, $username, $password);
eval() a string as if it were a PHP filei.e. a function like include_string($string) to parallel
include($filename).
eval($string) evaluates $string as if it were PHP code. If you want to
eval a string that looks like a PHP file (i.e. a string that contains
<?php and ?>), do:
function include_string($string) {
eval('?>' . $string . '<?php ');
}
(Astonishing that this works. What is the parser/interpreter doing there?!)
This is documented, somewhat misleadingly, on the eval manpage.
This less than helpful message may be emitted if a pragma command fails.
(You do get slightly more helpful error messages if there's an error in your
SQL proper.) For example, this error will be emitted if you set the charset
to a character set that doesn't exist. To diagnose the problem, it might
help to do a var_dump() on the database handle or statement
handle--sometimes useful information is embedded there.
Despite appearances, the largest file you can upload is affected by several
php.ini settings:
upload_max_filesizepost_max_size memory_limit (possibly)It's possible that since the uploaded file needs to be encoded, which increases their size, these limits need to be larger than you think.
See sapi/cgi/README.FastCGI in the source.
i.e. the equivalent of toString() or asString() in other
implementations.
Use the saveXML() method on the associated document:
echo $doc->saveXML($node);
Or, if you don't have the owner document handy:
echo $node->ownerDocument->saveXML($node);
strftime?As far as I can tell, there isn't one.
strtotime,
date_parse or--if you're using
WordPress--mysql2date might do in some circumstances.
Use php://input:
$data = file_get_contents("php://input");
The POSTed data is URL-encoded, so you may need to decode it first:
$data = urldecode(file_get_contents("php://input"));
Zend_Mail with Google Mail's SMTP server$config = array(
'auth' => 'login',
'username' => "XXXX@gmail.com",
'password' => "XXXX",
'ssl' => 'ssl', // not 'tls'
'port' => 465
);
$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
$mail = new Zend_Mail();
$mail->setBodyText('This is the text of the mail.');
$mail->setFrom('sender@test.com', 'Some Sender');
$mail->addTo('mjs@beebo.org', 'Some Recipient');
$mail->setSubject('TestSubject');
$mail->send($transport);
See configuring other mail clients.
Convert an object (i.e. $user->name) to an array (i.e. $user["name"]):
$arr = (array) $obj;
If you have nested objects you'll need to convert it manually:
function object_to_array($obj) {
if (!is_object($obj) && !is_array($obj)) {
return $obj;
}
else {
$a = array();
foreach ($obj as $k => $v) {
$a[$k] = object_to_array($v);
}
return $a;
}
}
(Might be able to use json_encode/json_decode as well.)
file_put_contents("/tmp/log", var_export($foo, true), FILE_APPEND | LOCK_EX);
$a = array();
foreach (debug_backtrace() as $s) {
$a[] = array(
"file" => $s["file"],
"link" => $s["line"]
);
}
rawlog($a);
It's up to the browser whether it obeys this, but you might have have success with:
header("Pragma: no-cache");
header("Cache-Control: private, no-cache, no-cache=\"Set-Cookie\", proxy-revalidate");
(From Google Analytics headers, I think.)
array_key_exists to check if a key exists?i.e. why not use isset()? The reason is that isset() can return true if
the thing you're checking isn't an array at all, but a string:
$foo = "asdf";
$v = isset($foo['qq']); // $v is true!
This is because the string 'qq' is cast to the number 0, and $foo[0]
is the first letter of the string $foo.
$sql = "SELECT * FROM entry WHERE email = ?";
$args = array("michael@example.com");
foreach ($args as $a) {
$sql = preg_replace("/\?/", is_numeric($a) ? $a : "\"" . $a . "\"", $sql, 1);
}
// $sql = "SELECT * FROM entry WHERE email = 'michael@example.com'";
(If you're doing this to figure out what SQL code is being executed against the database it may be faster to turn on MySQL query logging.)
Some things to know:
time() at the
same moment on computers in different time zones, you get exactly the same
value back.mktime/gmmktime -
Passed an array giving whose values are day, month, year, etc., returns
a Unix timestamp. mktime interprets its argument as a local time,
whilst gmmktime interprets its argument as a time in the time zone UTC.
(That is, given the same input gmmktime returns the same results
everywhere; mktime returns timezone-specific results.) Note that in this
case, the gm- prefix affects how the input is interpreted.strftime/gmstrftime -
Passed a Unix timestamp and format string, and returns a string. In
strftime's case, the string is the time according to the current
timezone, whilst gmstrftime returns the time in the UTC timezone.
(Given the same input, gmstrftime returns the same time in all timezones
(though not necessarily the same string--the actual string may be
different if the locale is different) whilst strftime returns
timezone-specific results.) Note that in this case, the gm- prefix
affects the output string.strptime - Inverse of
strftime/gmstrftime: passed a time string and a format string, and
returns an array representing the local time. (This not a great return
value; it would have been better to return a Unix timestamp.) The time
string is interpreted as a local time; there is no gm- equivalent, or
even any way to simulate one, since it ignores the value of
date_default_timezone_set.
Note that you can impose a timezone on the input string if it contains a
timezone abbreviation or offset (e.g. Sun 26 Apr 2009 21:50:35 BST)
which the format string reads with %z or %Z.date/gmdate - Passed
a Unix timestamp and a format string, returns a string. As with
strftime/gmstrftime, the gm- prefix affects whether the result is a
representation of the time in the current timezone or in the UTC timezone.
Note that the format string is completely different to that of
strftime/gmstrftime! (One reason to use this set of functions is for
the useful date format
constants.)
There is no inverse of this function.strtotime - Passed a string in "US English
date format", and returns a Unix timestamp. Note that there is no way to
override the US date format! strtotime("03/04/2008") is the 4th of
March 2008. Note that this function will parse relative times, like
tomorrow and next monday; this is about the only reason to use it.TZ environment variable and the
date.timezone ini option. (See
date_default_timezone_get
for more information.)Run with:
$ TEST_PHP_ARGS=-n make test
There's only ever one instance of class-static variables (or static properties)--even if the class is extended. (The derived classes do not get their own copies of the variable--it's shared with the parent and all other classes that are derived from the same base.
That is, if you have
class Base {
public static $data;
}
class Derived extends Base {
}
then Base::$data and Derived::$data refer to the same variable. (Within
both methods, self::$data similarly refers to the same thing.)
To test the /usr/local/php-5.3.0/bin/php binary using the phpt files in
ext/xsl/tests,
$ TEST_PHP_EXECUTABLE=/usr/local/php-5.3.0/bin/php sapi/cli/php run-tests.php ext/xsl/tests
(Can replace the directory with individual files as well.)
svn checkout?See http://www.php.net/svn.php.
Note if you're building on a virtual machine, you may wish to do the
checkout on the virtual machine, rather than on the host. This is because
the buildconf script seems to run svn under some circumstances, and if
the version of svn on the virtual machine is older than the version which
checkout out the source, it will fail.
gdb?If you have a broken test that you want to debug with gdb, you'll probably
still have the *.php file in a tests directory. (If the test fails,
run-tests.php keeps the generated parts.) In that case, you can debug
with gdb via something like:
$ gdb --args sapi/cli/php ext/xsl/tests/*method1.php
pear
[Edit: I don't recommend doing this anymore. pear causes a lot of
confusion and problems when installed with PHP, or separately. (In fact it
doesn't seem to be possible to install it separately, the INSTALL file
notwithstanding.)]
There's a few problems with the bundled pear: it gets confused, and it
also wants to install iself once for every PHP binary installed. It seems
to be slightly better to install pear separately (although there's
problems with this approach as well...).
go-pear.php from http://pear.php.net/go-pear.php go-pear.php./usr/local.php.ini.PHPUnit
PHPUnit directory somewhere like
/usr/local/lib/php.phpunit.php to phpunit, and then amend it so that it uses
set_include_path() to add /usr/local/lib/php to the include_path.phpunit to /usr/local/bin/phpunit.