This question already has an answer here:
Hi i've coded a web server using C language , a server just like apache or lighthttpd. it does listenings on port 80 and manipulates with GET & POST requests, i may handle text/html files, but my question here : how can i integrate PHP compiler with it so i would be able to handle php scripts in my http-server, thank you in advance !
I think the easiest way would be to run it as a system call.
You can get documentation here.
You will have to set the
$_SERVER
variables as environment variables for the call from values gleaned from the request header but then it should just be a matter of piping in the request body and returning STDOUT.you should be able to do something similar to support other server side languages as well (python, ruby etc..)