views:

318

answers:

4

Hi

I want to develop my next web project in C++ as FastCGI but I don't know how to start and google wasn't very friendly about this. I really don't know much about fastCGI or others libraries that makes cgi persistent... Tried to read some stuff, but it seems to be used along Linux with all those .configure Makefiles etc...

can anyone give me a basic tutorial but kinda detailed about this? I have windows vista sp1 and IIS is configured to accept CGI, I have Visual Studio 2008 and DevC++ too.

I downloaded the kit from fastcgi.com but its hard to understand the basics of it. A real simple howto on building a hello world, using fastcgi(any library that I can use persistent code) would be very nice.

The basics, seriously, like I don't know if I can just include the files from the a fastcgi project to my project and compile both together, if that will work with my IIS. Even if that would work, I don't know which one I should build from fastCGI dev kit, there is a cgi-fcgi and libfcgi folders with files in them and there is Makefiles placed in almost all folders -_-"...

I know that CGI in C++ is dificult to develop because it doesn't use templates and because you must take care of memory managment... But I want to give it a try. I am kinda tired of scripting languages and their restrictions/limitations.

Sorry my english, I hope I was clear enough.

Thanks, Joe

A: 

You might want to look at a library like cgic, FastCGI, or Wt instead of writing the CGI code on your own. Each of these libraries has a basic API that's very easy to use - just like any simple library.

greyfade
A: 

If you are serious about wanting to do this, then I'd recommend looking at CppCMS, a C++ web application framework. If you find that you really don't want any kind of framework, then check out the documentation at fastcgi.com. There's a C tutorial there that you can just replace all the C calls (mostly IO) with C++ std lib calls.

Shaun
+2  A: 

I would not recommend you to use FastCGI with IIS. IIS support of FastCGI is very limited -- it allows communication only over pipes and only one request is passed to process.

FastCGI was added to IIS to somehow connect PHP and several other technologies to IIS.

If you want to create web applications in C++ I would recommend you to use non-MS development environment.

About programming. There are few tools to work with C++ for web, especially for MS environment:

  1. You may work directly with libfcgi and parse queries on your own -- quite a hard job but for very simple tasks it is fine.
  2. You may use some higher level libraries like CgiCC -- it is good for some basic stuff like forms, cookies but it is still quite limited.
  3. You may use a full MVC web framework like CppCMS. But I would not recommend you to work in Windows environment for this purposes.
  4. You may also try Wt for "GUI-over-Web" development style.
Artyom
A: 

discard cgi and go for dynamicly loaded c++ code into apache... libapache2-mod-raii is a complete framework with builtin database connexion pools, sessions and all the stuffs that makes developping web applications enjoying !

Guillaume Gimenez