我如何将PHP与我的Http服务器集成? [英] How can i integrate php with my Http-server?

查看:143
本文介绍了我如何将PHP与我的Http服务器集成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我使用C语言编写了一个Web服务器,就像apache或lighthttpd一样。
它在端口80上进行侦听并使用GET& POST请求,我可能会处理text / html文件,但我的问题是:如何将PHP编译器与它集成,以便我能够在我的http服务器中处理php脚本,提前谢谢!

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.

您可以获取文档这里

您必须将 $ _ SERVER 变量设置为来自的呼叫的环境变量从请求标头收集的值,但它应该只是在请求主体中管道并返回STDOUT。

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.

你应该可以做类似的事情来支持其他服务器端语言(python,ruby等..)

you should be able to do something similar to support other server side languages as well (python, ruby etc..)

这篇关于我如何将PHP与我的Http服务器集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆