As the topic says, I wanted to know if we could program a web application in C++. I mean, you can do stuffs in php. Google Appengine allows Python and Java. Can we use C/C++ ?
NaCl is for client stuff only. There are some web toolkits for C/C++, but IMHO this is not the right tool for the job. Writing web stuff in C++ is like writing hard-real-time applications in Java.
Web Applications? Java, C#, ASP, PHP are the things that come to mind. Like rapidcoder said, C++ is the wrong tool for the job. C++ is for software development and not web applications. You wouldn't use assembly to make a web page.
I agree that C/C++ is not the right tool to use but to answer your question. The answer is YES! I tried to write a simple form processing program before.
I've written a simple library for CGI in C++. You can get it here: http://github.com/ChrisSwinchatt/CGIPP
At the moment, all it does is parse & simplify POST and GET requests, so it's quite minimalist in that respect. Ideally I'll be adding more features to it later.
It's quite easy to use. Here is an example of parsing GET requests:
I think most larger applications use Java (well, of course that's not very much 'scripting').
I heard RoR is good, though I only did the first few parts of the Rails for Zombies series. Also heard Seaside is good if you're actually writing a web application. (Though I don't know how hard it is to find a webhost that supports seaside).
I was under the impression facebook's backend was PHP and SQL
And who told you Facebook scales well? ;) They are just very desperate. Actually they had a *lot* of problems with scalability. They are fighting them with memcached, clever architecture and lots of duct tape, but well, other big data companies achieve scalability probably with much less effort using proper databases that are designed to scale out of the box (e.g. google).
I use my C++ program exclusively from the web browser via CGI and apache web server. I used to use wxWidgets (before that FOX GUI and before that native WINAPI), but actually CGI + chrome browser is far superior to any GUI toolkit I tried. One more thing: as Apache automatically caches your .exe in RAM, in fact boot time for your program is much better.
Alternatively, you can implement your own socket connections and circumvent using Apache.
Here is my calculator project computing the 100th fibonacci number:
What "everything else" do you mean? Java is perfect on the server side, so if I used Java there, why would I need to use also C++? And on the client side, you can use JS+HTML5 or Flash, or if you need better performance - Java or Silverlight.
As an alternative, you can also use Emscripten to "compile C and C++ code into JavaScript and run that on the web
Yeah, if you don't mind making everything 100x - 200x slower, you can do it that way. Hand optimised JS is still order of magnitude slower than Java/C++, and automatically generated JS is another order of magnitude slower than hand optimised JS.