How can i integrate php with my Http-server? [dupl

2019-09-06 19:04发布

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 !

1条回答
闹够了就滚
2楼-- · 2019-09-06 19:56

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

查看更多
登录 后发表回答