Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ CGI nowadays [closed]

Tags:

c++

php

cgi

fastcgi

enter image description here
(source: atmel.com)

Background

I've a 5 years PHP background and in the last month I've been busy finding a way to do web with C++ (even if I know this is childish and stupid, I feel like C++ is the only true programming language and I have this sort of religious faith in it that makes me love it and only it).

My CGI trip

I've come across several blog posts (mostly from 2000-2003), discussions and had some chat discussions here. This is what I've gathered:

  • PHP is designed for the web while C++ is a generic purpose language.
  • PHP is inconsistent and have a lot of hate on the web
  • PHP is the most common and supported scripting language out there
  • CGI is a pretty old and common technology that was used in the days before PHP (PHP1 was actually a CGI library for C)
  • In CGI (vs PHP) we have the problem of the fork-exec execution for each process which kinda slows everything down
  • ^ this is what FastCGI is there for
  • For some common mathematic operations C++ is 200X faster than PHP (because of PHP being an interpreted language)
  • Big websites that requires performance doesn't use pure PHP (Facebook use HipHop which is something related to C++ and on Google there are several rumors about it being written in Perl, C++, C or some other language but PHP)
  • PHP is faster to learn and to write
  • C++ has very bad string manipulation methods
  • There are some good (subjective) libraries for C++ CGI like wT (witty).
  • Some people just told me to stay away from PHP as far as I could

Real question(s)

Today I have to decide whatever to go with PHP or CGI. And I'm asking you:

  1. Is CGI dead in 2013? (yeah I know it has been asked before)
  2. Since everybody needs performance and considering that I've time to spend like 1 year to build a solid C++ library for the web and that I don't like easy things, what are the cons in using CGI (or FCGI) nowadays (in comparison to newer techonologies)
  3. Is there a more efficient way to build websites with C++
  4. What is the real deal with FastCGI?
  5. Is FastCGI widely supported?
  6. Considering a project where I have to build a web tool, web app, iphone app, pc app and mac app all around a single website/server/database, can I actually reuse some code from the C++ website for my applications? (the database interaction for example)?
like image 959
Shoe Avatar asked Nov 10 '12 14:11

Shoe


1 Answers

  1. Almost used for only very specific cases
  2. Don't build one use one: CppCMS*
  3. Yes, C++ Web Frameworks
  4. Because it is dead for a long time ago
  5. It replaces CGI making it VERY efficient
  6. Yes - all major (and minor) web servers support it

* Full-disclosure: I am the author

like image 142
Artyom Avatar answered Sep 24 '22 13:09

Artyom