3 ms·
If you do want do do it in c, I think php pretty much got it right -- write an extension in c, and use something else for the rest. Se eg: http://phalconphp.com
by e12e 13y ago
If you do want do do it in c, I think php pretty much got it right -- write an extension in c, and use something else for the rest. Se eg: http://phalconphp.com/en/ http://phalconphp.com/en/
Then there's of course G-Wan -- source of a lot of speculation, and frequent border-irrational (counter)claims by it's author -- but undoubtedly a good contender for easy-to use server with c-language "scripting":
http://gwan.com/ http://gwan.com/
A newer server in the same space is nxweb, which seems made for doing the kind of work the article talks about - simple, high performance web-services in c:
https://bitbucket.org/yarosla/nxweb/wiki/Home https://bitbucket.org/yarosla/nxweb/wiki/Home
For other languages, have a look at hello-world webservers at rosetta:
http://rosettacode.org/wiki/Hello_world/Web_server#C http://rosettacode.org/wiki/Hello_world/Web_server#C
Other related projects:
mongoose - small embeddable, cross platform web server w/lua scripting: http://cesanta.com/ http://cesanta.com/
lighttz - webserver in c using libev: http://arekzb.wordpress.com/2008/04/27/lighttz-a-simple-and-fast-web-server/ http://arekzb.wordpress.com/2008/04/27/lighttz-a-simple-and-...
Still, if it were me, and I needed "c-speed", I'd probably go with cgi (or fastcgi). Forking on every request might not be the absolute fastest, but with the binary cached in ram, it's still pretty fast on Linux. Or maybe just use mongrel2 and a c handler:
https://github.com/derdewey/mongrel2_c_handler/tree/master/lib https://github.com/derdewey/mongrel2_c_handler/tree/master/l...