A. HOW TO MAKE YOUR PC A WEB SERVER?
*****************************
B. HOW TO RUN A C++ PROGRAM THROUGH CGI?
GO to the TERMINAL.
GIVE Commands like these to install APACHE2(A Web Server)
sudo apt-get update
sudo apt-get install apache2
IT WILL TAKE SOME TIME TO INSTALL,check whether its instaled properly or not by typing thecommand
service apache2 status
WAYS TO CHECK APACHE2 IS INSTALLED OR NOT?
THAT'S ALL ABOUT THE 1ST PART.... NOW MOVING ON TO 2ND.. i.e
HOW TO RUN A C++ PROGRAM THROUGH CGI?
U need to save your program in cgi-bin folder so that it can run on LOCALHOST……..
The common MIME(multipurpose internet mail extensions) types are text/plain for unformatted text and text/html for HTML formated content.
you can change the background colour by typing..
in coding
NOW, A user input c++ program
What’s new here is the part after the “?”. The information after the “?” character is known as a query string. When the server is passed a URL with a query string, it calls the CGI program identified in the first part of the URL (before the “?”) and then stores the part after the “?” in the environment variable QUERY_STRING. A Query String, by its name suggest that it is a string used to ‘Query’. The query string begins after the first ‘?’ character. Query strings are usually used to pass a list of variables
PERMISSIONS
chmod 777 fact.cgi
chmod 777 cgi-bin
chmod 777 form.cgi
777: Its for all READ, WRITE and EXECUTE
We had done with how to print a mathematical table program...
There is another example furthur to print factorial of a no. coded in same way....
Form supplies the query string to this CGI program. The following is the program, named as form.cpp that contains the form in CGI format.
Text