Difference between revisions of "Lesson 2"
(Added glossary link to Prompt~) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | Linux / Apache / GT.M / Web Application Lesson 2 | + | Linux / Apache / GT.M / Web [[Application~|Application]] Lesson 2 |
+ | |||
+ | By Ben Irwin, | ||
+ | Copied from: http://www.doggiedudes.com/fscc/list.htm | ||
Tutorial Home: [[M Web Tutorials]] | Tutorial Home: [[M Web Tutorials]] | ||
Line 29: | Line 32: | ||
---------------------------------------------------------------- | ---------------------------------------------------------------- | ||
− | If we run the cgi script from the Linux prompt using the following command: | + | If we run the cgi script from the Linux [[prompt~|Prompt]] using the following command: |
library.sh1 or ./library.sh1 depending on your Linux setup you should get the following listing. | library.sh1 or ./library.sh1 depending on your Linux setup you should get the following listing. | ||
Line 60: | Line 63: | ||
Well, I guess you get the idea. | Well, I guess you get the idea. | ||
− | The important concept to learn from this lesson is that what prints to the screen when a cgi script is run at the Linux prompt is the same information that gets sent to the web browser. | + | The important concept to learn from this lesson is that what prints to the screen when a cgi script is run at the Linux [[prompt~|Prompt]] is the same information that gets sent to the web browser. |
Tutorial Home: [[M Web Tutorials]] | Tutorial Home: [[M Web Tutorials]] |
Latest revision as of 10:52, 5 March 2012
Linux / Apache / GT.M / Web Application Lesson 2
By Ben Irwin, Copied from: http://www.doggiedudes.com/fscc/list.htm
Tutorial Home: M Web Tutorials Prev: Lesson 1 Next: Lesson 3
In Lesson 1 we placed the following cgi script file in the cgi-bin directory for our web server. When we called it using the web server it just wrote "Hello world!" to the web page and put the title "Hello world demo." in the web browser title bar.
library.sh1 ---------------------------------------------------------------- #!/bin/sh echo Content-type: text/html echo
echo "<html>" echo "<head>" echo "<title>" echo "Hello world demo." echo "</title>" echo "</head>" echo "<body>" echo "Hello world!" echo "</body>" echo "</html>" ----------------------------------------------------------------
If we run the cgi script from the Linux Prompt using the following command: library.sh1 or ./library.sh1 depending on your Linux setup you should get the following listing.
---------------------------------------------------------------- Content-type: text/html <html> <head> <title> Hello world demo. </title> </head> <body> Hello world! </body> </html> ----------------------------------------------------------------
The "Content-type: text/html" line tells the browser to treat this document as a html file.
Html tags usually go in pairs one to start a section and another to end a section.
The <HTML> tag starts the html page. The </HTML> ends the html page.
The <HEAD> tag starts the header section. The </HEAD> tag ends the header section.
The <TITLE> tag starts the title section. The </TITLE> tag ends the title section.
Well, I guess you get the idea.
The important concept to learn from this lesson is that what prints to the screen when a cgi script is run at the Linux Prompt is the same information that gets sent to the web browser.
Tutorial Home: M Web Tutorials Prev: Lesson 1 Next: Lesson 3