another option is to find dragonzap's STDIO dll and run PHP 4.1.0 or greater with the CLI sapi...

You can capture output, input, etc. Screw this DLL 2 mySQl messyness, i won't even rant about sockets.

pmsg me if you are interested in finding out more