How do you use C or C++ or Java for web scripting, to replace languages like PHP?
-
I'm familiar with all the three, and can write command line based programs in them but I never got to know how would one use them for web programming. I've heard FB uses a lot of C++ on their backend, and Google too. But I can't seem to find a tutorial or a book that'd explain how to use these languages for web scripting....
-
Answer:
If your question is how can we use C, C++ or Java for web apps then the answer is, it is do-able. Refer these: http://library.thinkquest.org/16728/content/cgi/cplusplus.html http://www.guyrutenberg.com/2007/08/10/introduction-to-c-cgi/ For Java, Java with the help of JSP, Servlets and Apache/Tomcat (or any web/app server) can do a good job of creating web apps.
Pradeep Krishnan at Quora Visit the source
Other answers
You can use C,C++ as a backend.You can associate same codebase in business-logic layer via web services or other APIs. Facebook uses php as front-end and C,C++ as backend. The downside is that time to market is much longer and it is much harder to get programmers up to speed with the system and introduce new features and all the coders have to work in A1 grade. So it is important to follow rule of "He who iterates fastest wins" is one of the reasons why people uses PHP instead of JAVA or C,C++ for web development.
Ravi Raj
There are few company use c/c++ as pure web logic layer, they change a lot Especially nowadays. We iterate quickly, develop speed matters. We use dynamic languages instead, it's PHP. Back to topic. We used to use c++ to write web pages. For simpilicity. Web pages are just streams of output upon TCP, so it's not that different to write a command line programm and web application. HTTP protocol have detailed standard about it. In short you command line tools read and write to stdin/stout. Web page programm read request from socket between user and your server,response by write to it. So languages just doesn't make it different. Practically, we always use a standalone we server to handle user requests, then forward it to the real application. Between your we server there might some other protocol except http,eg, fast cgi,cgi. If you use cgi,you could write web application in command line tools(so any language fits you).but the performance sucks.
Reeze Xia
I think that Facebook and Google use C++ and other languages in the backend. Possibly to query the database for more speed. In php there is a function exec() which can be used to run command line. You could possibly use this to run C++ or Java code
Haseeb Khan
Remember that the C and C++ used in large sites may be far removed from the request handling/CGI code, and actually called indirectly from (say) a PHP or Python front-end, in the form of library, job/cache/search/database server, etc. If you want to use C++ for the front-end, there is Wt: http://www.webtoolkit.eu/wt
Toby Thain
I know facebook wrote HipHop for PHP that compiles into C++ for their backend. https://github.com/facebook/hiphop-php/wiki/
Chad Hietala
There is Web Framework name wt(http://www.webtoolkit.eu/wt) Which is like Qt Framework. its easy and Quite cool. But i don't know it can be used in production environment.
Tamil Selvan
Related Q & A:
- How Can I use .net dll in C program?Best solution by Stack Overflow
- How to use GUI in c language?Which is best GUI for c?Best solution by Quora
- How do I use my web cam for instant messaging?Best solution by Yahoo! Answers
- How to use c++ and to work with it?Best solution by cplusplus.com
- How do I use the web cam on my computer?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.