0

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 !

EvilThinker
  • 740
  • 1
  • 9
  • 13

1 Answers1

1

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..)

Orangepill
  • 24,500
  • 3
  • 42
  • 63
  • yes it's all about setting env variables! i think there's something nammed FastCGI which is a good solution, but i don't know if i can use it under windows. – EvilThinker May 15 '13 at 21:25