Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Output from CGI

Status
Not open for further replies.

manishrathi

Programmer
Feb 26, 2009
6
US
I have CGI on Apache server. When a request comes in for this CGI, server invokes CGI and output is sent back to the client.

When I was reading book on CGI, this sentence I could not understand. "Once CGI program starts running, it sends its output back to the web server via standard output."

CGI is already on the server and thats where it runs. So where is the question of sending output "back to web server" ? STDOUT sends output on the terminal. So if I am working on server, then on that terminal, output will come. I am on a different terminal than server and sending request from this terminal. In this case, output is sent to client terminal. Is it still standard output ?

Pls explain.
 
CGI sends its output to the server, probably an http server, which sends the data back to the client, usually a web browser.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Does CGI reside outside the web server ? Is CGI invoked on anywhere else than web server ?
If CGI is on web server in /cgi-bin directory. So whenevr a CGI is invoked, it is processed on web server only and output is on web server only. So where is the question of sending output to web server ?

Pls explain
 
In a nutshell.....

CGI is a type of communication between computers, just like HTTP and FTP are also ways computers communicate. A CGI script (could be written in many differnt programming languages) sends its STDOUT to the server, the server eventually sends the output from the CGI script back to a client, the client could be a web browser or another server.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
I think you're getting confused by the phrase "web server", and interpreting it to mean "a computer attached to the internet that serves up web pages". Viewed like that, as you observe, the description of the cgi program outputting to the web server doesn't make much sense.

But "web server" can also describe a bit of software running on a computer that enables it to serve stuff to the web. Apache is a web server, for example. That's the context your book is using:
Once CGI program starts running, it sends its output back to the web server [software running on your computer] via standard output.
If I'd written it, I'd have included the italic bit to avoid confusion!

The bottom line is, though, that a program invoked across the web using cgi sends its standard output (eventually) to the web browser session that invoked it.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top