A. HOW TO MAKE YOUR PC A WEB SERVER?
*****************************
B. HOW TO RUN A C++ PROGRAM THROUGH CGI?
WEB SERVER
A web server is an information technology that processes requests via HTTP, the basic network protocol used to distribute information on the World Wide Web. The term can refer either to the entire computer systemor specifically to the software that accepts and supervises the HTTP requests.
I am here going to do it on ubuntu..
INSTALLATION PROCESS
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
SUCCESSFULLY INSTALLED APACHE2
WAYS TO CHECK APACHE2 IS INSTALLED OR NOT?
- Type localhost on your browser.
- write your IP address in browser.
CGI
It stands for common gateway interface.Its a standard way for web server to pass web user’s request to an application program and to receive data back to forward to the user
THAT'S ALL ABOUT THE 1ST PART.... NOW MOVING ON TO 2ND.. i.e
HOW TO RUN A C++ PROGRAM THROUGH CGI?
STEP1: PROGRAM
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.
A SIMPLE PROGRAM
EXECUTION
BROWSER...
you can change the background colour by typing..
cout<< “<body bgcolor= blue> “
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
STRUGGLES
- Didn't know first about give permissions to cgi folder and program.
- TERMINAL is case sensitive. do write commands properly
- check the location where cgi-bin is stored
- got to know litttle bit about html by doing this task as i m not familiar with this language.
THANK YOU :)
deck
By deeptisharma
deck
- 572