line 16 of php.py needs to be changed to :
(out, inp) = popen2.popen2("php", mode='b')
This fixes an error when sending a string over 4KB (for example, to a write to file function)
Also, just to note, to resolve another error that might occur in one's application code, escape the single quote in a string sent to php code within python. e.g., str = str.replace("'", "'")
TY