Lesson 1

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

By Ben Irwin, Copied from: http://www.doggiedudes.com/fscc/list.htm

Tutorial Home: M Web 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.

Note: You can check your Package Manager or Add/Remove Software to see if Apache is installed. The program itself is httpd, it is started with apachectl, and you will need the cgi-bin directory. You can locate these with $ find / -iname httpd $ find / -iname apachectl $ find / -iname cgi-bin To manually start Apache (until the next reboot), become root and invoke apachectl: $ su - root Password: To test it, open a browser and type "localhost" into the address. You should get an Apache splash page. Run "apachectl stop" and reload the browser webpage; it should be "Unable to connect". Further documentation is at Apache.org. End of note.
 * 1) apachectl start

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
 * 1) !/bin/sh

echo Content-type: text/html echo echo "&lt;html&gt;" echo "&lt;head&gt;" echo "&lt;title&gt;" echo "Hello world demo." echo "&lt;/title&gt;" echo "&lt;/head&gt;" echo "&lt;body&gt;" echo "Hello world!" echo "&lt;/body&gt;" echo "&lt;/html&gt;" --- 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 your browser to your new cgi script using something similar to the following line. Change "localhost" to the IP address of your own Linux server, if necessary.

http://localhost/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: M Web Tutorials Next: Lesson 2