PHP can be also used as a cgi/binary to which you pass the input and get html output. That's how most other web servers do it (usually via fastCGI). So basically you need a network framework for the communication and a fastcgi/cgi interface to talk with PHP. Not trivial but doable.