tags:

views:

595

answers:

4

I'm looking at doing some work (for fun) in a compiled language to run some simple tests and benchmarks against php.

Basically I'd like to see what other people use for C++ CGI programming. (Including backend database, like mysql++ or something else)

+2  A: 

If I were thinking of working at that level, I'd probably just write a straight-up Apache or IIS module instead of a CGI.

That said, if you do want to go with CGI, I'd suggest using the venerable cgic from Thomas Boutell. It's a "plain" C library, but it's been in constant use since the mid '90s so it's thoroughly tested and solid as a rock.

Sherm Pendley
+1  A: 

In short, I don't think there is such a thing for generic server CGI programming (happy to be proven wrong of course).

Instead you'll probably have to target the server APIs, such as Apache's. This looks like a reasonable introduction to request processing, which will be a big part of what you're doing.

As an alternative, Lighttpd may be even more developer-friendly, and (particularly if you're looking at performance) faster.

I note there's a cpp-netlib under development but it seems to be HTTP client only.

Alastair
Yes, CGI is quite generic. That's the whole point, to standardize the interface between a web server and a child process that's launched to service a request. I've written CGIs with Turbo C using Bob Denny's HTTP server, for deployment on SGI servers running NCSA's, with no trouble at all.
Sherm Pendley
And yes, I realize how old it makes me sound, talking about Denny's server for Windows NT, and about the NCSA httpd that predates Apache. Get off my lawn! :-)
Sherm Pendley
I was originally looking at GNU Cgicc as it is GNUs, and therefore usually solid. They do exist for sure though, but going the 'direct to api' route is interesting as well.
Issac Kelly
+7  A: 

I'm not sure exactly what you're looking for, but there is a C++ web framework called wt (pronounced "witty"). It's been kept pretty much up to date and if you want robust C++ server-side code, this is probably what you're looking for.

You can check it out and read more at the wt homepage.

P.S. You may have some trouble installing wt if you don't have experience with *nix or C++ libraries. There are walkthroughs but since frameworks like these are the road less traveled, expect to hit a few bumps.

Dan Loewenherz
This looks almost exactly like what I was looking for, but I'm an avid JavaScript developer as well, My first impression (without research) is that this tries to do the JS for you. True?
Issac Kelly
Well, I haven't used this framework myself, other than testing out the "Hello, World" app, but they maintain that you can.There's support for "custom JavaScript (e.g. for client-side only event handling), and emit C++ signals from this custom JavaScript." - http://www.webtoolkit.eu/wt#/features
Dan Loewenherz
A: 

Another option is the Cgicc library which appears to be mature (currently at version 3.x):

http://www.gnu.org/software/cgicc/

Yukiko