Lesson 1

From VistApedia
Revision as of 18:46, 10 October 2006 by Forummgr (talk | contribs)
Jump to: navigation, search

Linux / Apache / GT.M / web application / FileMan and VISTA

Tutorial Home: M2Web Tutorials
Next: Lesson 2

I am going to provide a little tutorial on this mailing list to introduce the readers to web applications. We will be using the Apache web server, simple cgi scripts, gradually increasingly complex mumps routines and finally moving to FileMan and VISTA database calls to produce our web application. Our final project will be a web application to catalog books, videos, and magazines.

Disclaimer: This is only a tutorial. I will be using techniques that may not be secure for an open internet solution. I obviously make no warranties regarding the programs or techniques. Be sure to read the responses to this e-mail tutorial, I am sure that the more security aware readers will share their understanding and wisdom. I invite everyone's input. It will make the process more of a learning experience.

Ok here we go. Lesson 1 - Linux / Apache / CGI Scripts and the great "Hello world" program.


Most Linux installations come with an Apache web server. It is beyond the scope of this letter to explain how to get the web server up and running. We are going start in the cgi-bin directory to produce our CGI script.

On my Linux / Apache installation the default place to write cgi scripts is in the /var/www/cgi-bin directory.

We are going to create a cgi script that will produce the single statement "Hello world!" on a web page. The name of our file is going to be "library.sh1".

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>"

---------------------------------------------------------------

Now make the permissions to the file so that they include executable permissions.

chmod 777 library.sh1

-rwxrwxrwx 1 apache   apache   211 Aug 20 19:32 library.sh1*


Now aim you browser to your new cgi script using something simular to the following line. Change the IP address to your own Linux server address.

http://10.0.1.209/cgi-bin/library.sh1

You should see a web page with the following line.

Hello world!
And the web page header should say "Hello world demo."

Tutorial Home: M2Web Tutorials
Next: Lesson 2