CouchDB lets you hook up any language interpreter or compiler & executor via a simple line-based protocol that gets exchanged over standard in- and output. The core PHP code to wrap the PHP interpreter around that protocol and stdio is not even 70 lines of code and 130 with a some helper functions and comments. It needs PHP 5 and the JSON extension.
A code example is included showing how to make a sample request back to the CouchDb and the script to handle the parsing. If you'd like to customize things a bit more, check out the wiki pages for the protocol to get started.