Difference between revisions of "Lesson 1"

From VistApedia
Jump to: navigation, search
(Added glossary link to Application~)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Linux / Apache / GT.M / web application / FileMan and VISTA
+
Linux / Apache / GT.M / web [[application~|Application]] / FileMan and VISTA
 +
 
 +
By Ben Irwin,
 +
Copied from: http://www.doggiedudes.com/fscc/list.htm
  
 
  Tutorial Home: [[M Web Tutorials]]
 
  Tutorial Home: [[M Web Tutorials]]
 
  Next: [[Lesson 2]]
 
  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.
+
I am going to provide a little tutorial on this mailing list to introduce the readers to web [[application~|Application]]s.  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~|Application]].  Our final project will be a web [[application~|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.
 
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.
Line 11: Line 14:
  
  
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.
+
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
 +
<pre>
 +
$ find / -iname httpd
 +
$ find / -iname apachectl
 +
$ find / -iname cgi-bin
 +
</pre>
 +
To manually start Apache (until the next reboot), become root and invoke apachectl:
 +
<pre>
 +
$ su - root
 +
Password:
 +
# apachectl start
 +
</pre>
 +
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 [http://httpd.apache.org/docs/2.0/invoking.html Apache.org]. End of note.
 +
 
 +
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.
 
On my Linux / Apache installation the default place to write cgi scripts is in the /var/www/cgi-bin directory.
Line 17: Line 36:
 
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".
 
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".
  
 +
<pre>
 
  library.sh1
 
  library.sh1
 
 
  ----------------------------------------------------------------
 
  ----------------------------------------------------------------
 
  #!/bin/sh
 
  #!/bin/sh
Line 39: Line 58:
 
   
 
   
 
  ---------------------------------------------------------------
 
  ---------------------------------------------------------------
 
+
</pre>
 
Now make the permissions to the file so that they include executable permissions.
 
Now make the permissions to the file so that they include executable permissions.
 
+
<pre>
 
  chmod 777 library.sh1
 
  chmod 777 library.sh1
 
   
 
   
 
  -rwxrwxrwx 1 apache  apache  211 Aug 20 19:32 library.sh1*
 
  -rwxrwxrwx 1 apache  apache  211 Aug 20 19:32 library.sh1*
 +
</pre>
  
 +
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.
  
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://localhost/cgi-bin/library.sh1
 
 
  http://10.0.1.209/cgi-bin/library.sh1
 
  
 
You should see a web page with the following line.
 
You should see a web page with the following line.

Latest revision as of 14:31, 22 February 2012

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: 
# apachectl start

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.

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