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

柔情痞子 提交于 2019-12-13 04:31:57

问题


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:


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



来源:https://stackoverflow.com/questions/16570998/how-can-i-integrate-php-with-my-http-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!