title: C++ CGI nowadays
body: <p><a href="https://i.stack.imgur.com/yK8Jc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yK8Jc.jpg" alt="enter image description here"></a><br>
  <sub>(source: <a href="http://www.atmel.com/Images/compiler.jpg" rel="nofollow noreferrer">atmel.com</a>)</sub>  </p>
  
  <p><strong>Background</strong></p>
  
  <p>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).</p>
  
  <p><strong>My CGI trip</strong></p>
  
  <p>I've come across several blog posts (mostly from 2000-2003), discussions and had some chat discussions here. This is what I've gathered:</p>
  
  <ul>
  <li>PHP is designed for the web while C++ is a generic purpose language.</li>
  <li>PHP is inconsistent and have a lot of hate on the web</li>
  <li>PHP is the most common and supported scripting language out there</li>
  <li>CGI is a pretty old and <em>common</em> technology that was used in the days before PHP (PHP1 was actually a CGI library for C)</li>
  <li>In CGI (vs PHP) we have the problem of the <code>fork-exec</code> execution for each process which kinda slows everything down</li>
  <li>^ this is what FastCGI is there for</li>
  <li>For some common mathematic operations C++ is 200X faster than PHP (because of PHP being an interpreted language)</li>
  <li>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)</li>
  <li>PHP is faster to learn and to write</li>
  <li>C++ has very bad string manipulation methods</li>
  <li>There are some good (subjective) libraries for C++ CGI like wT (witty).</li>
  <li>Some people just told me to stay away from PHP as far as I could</li>
  </ul>
  
  <p><strong>Real question(s)</strong></p>
  
  <p>Today I have to decide whatever to go with PHP or CGI. And I'm asking you:</p>
  
  <ol>
  <li>Is CGI dead in 2013? (yeah I know it has been <a href="https://stackoverflow.com/questions/1464652/is-cgi-dead">asked before</a>)</li>
  <li>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)</li>
  <li>Is there a more efficient way to build websites with C++</li>
  <li>What is the real deal with FastCGI?</li>
  <li>Is FastCGI widely supported?</li>
  <li>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)?</li>
  </ol>