diff --git a/SConstruct b/SConstruct
index 8a801f76c6ee226017d2065c10d9e497e709969f..dac010753d5fd91088fe94d1536eef3d21ffc34a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -93,9 +93,9 @@ env["ENV"].update(x for x in os.environ.items() if x[0].startswith("CCC_"))
 
 #rootpath = env['ROOTPATH'] = os.path.abspath('.')
 #env.Append(CPPPATH=os.path.join('#', "hammer"))
-env['testruns'] = []
 
 testruns = []
+
 targets = ["$libpath",
            "$incpath",
            "$parsersincpath",
diff --git a/src/bindings/php/README.md b/src/bindings/php/README.md
index 1c9f0fb42bc058fe08121b7bd7def193b3ed9a5c..8e11cb9eab79e9130ae306276379be486956f081 100644
--- a/src/bindings/php/README.md
+++ b/src/bindings/php/README.md
@@ -1,12 +1,18 @@
-Installing
-==========
+Building
+========
 Requirements:
 * SWIG 2.0
 * A properly configured [phpenv](https://github.com/CHH/phpenv)
 
+SCons finds your PHP include path from `php-config`, so if you don't have that working, you're going to have a bad time.
+
 If you want to run the tests, you will also need to install PHPUnit. Do this with pyrus and save yourself some hell. 
 
     pyrus channel-discover pear.phpunit.de
     pyrus channel-discover pear.symfony.com
     pyrus channel-discover pear.symfony-project.com
     pyrus install --optionaldeps phpunit/PHPUnit
+
+Installing
+==========
+We're not building a proper package yet, but you can copy `build/$VARIANT/src/bindings/php/hammer.so` to your PHP extension directory (`scons test` will do this for you if you're using phpenv; for a system-wide php you'll probably have to use sudo) and add "extension=hammer.so" to your php.ini. There is a "hammer.ini" in src/bindings/php for your convenience; you can put it in the `conf.d` directory where PHP expects to find its configuration. `scons test` will do this for you too.
\ No newline at end of file
diff --git a/src/bindings/php/SConscript b/src/bindings/php/SConscript
index bed12266d3e2746ae099d9d59853e418f0c1a0c8..aa9a53576b3692575a90ec57d05419cfc2a31b44 100644
--- a/src/bindings/php/SConscript
+++ b/src/bindings/php/SConscript
@@ -1,6 +1,6 @@
 # -*- python -*-
 import os, os.path
-Import('env libhammer_shared')
+Import('env libhammer_shared testruns')
 
 phpenv = env.Clone(IMPLICIT_COMMAND_DEPENDENCIES = 0)
 
@@ -17,8 +17,15 @@ Default(swig_src, bindings_src, libhammer_php)
 
 phptestenv = phpenv.Clone()
 phptestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0]))
-phptests = ['Tests']
-testphp = phptestenv.Alias("testphp", phptestenv.Command(phptests, [libhammer_php], "phpenv exec phpunit -v --include-path "+os.getcwd()+" $TARGET"))
-env['testruns'].append(testphp)
-print "Testing: " + str([str(x[0]) for x in env['testruns']])
+phptests = ('Tests')
+phpextprefix = os.popen("php-config --extension-dir").read().rstrip()
+phplib = phptestenv.Command(os.path.join(phpextprefix, "hammer.so"), libhammer_php, Copy("$TARGET", "$SOURCE"))
+phpprefix = os.popen("php-config --prefix").read().rstrip()
+phpincl = phptestenv.Command(os.path.join(phpprefix, "hammer.ini"), "hammer.ini", Copy("$TARGET", "$SOURCE"))
+phptestexec = phptestenv.Command(phptests, [phplib, phpincl], "phpenv exec phpunit -v --include-path " + os.path.dirname(libhammer_php[0].path) +" src/bindings/php/Tests")
+print "phptestexec path: " + phptestexec[0].path
+phptest = Alias("testphp", [phptestexec], phptestexec)
+AlwaysBuild(phptest)
+testruns.append(phptest)
+print "Testing: " + str([str(x[0]) for x in testruns])