No announcement yet.

Need Help With CGI and Abyss

  • Filter
  • Time
  • Show
Clear All
new posts

  • Need Help With CGI and Abyss

    Well, here it is several months later but after a number of digressions I'd really like to finally learn CGI with PowerBASIC. Presently I'm stuck though. I can't get Joe's example or any other CGI example to work. Here is where I'm at....

    I followed Joe's recommendations and downloaded and installed the X1 version of the Abyss Web Server. I followed the standard install and it is located in "C:\Program Files\Abyss Web Server" on a Win 2000 Pro Laptop. Under that directory are the following folders...


    I downloaded Joe's Contact.htm and placed it in \htdocs. Is that the right place? From my studying of Joe's tutorial #1 I gather that it is.

    I put in my PB \Includes folder so I could compile his Contact.bas to an exe and that went fine. I wasn't sure where that should go in the above directory schema so I put it in htdocs too (more about that later).

    Also, I noted, copied, printed out and studied in great detail the various interactions John Tate had here in his learning process. On Mar 10th, 2008, 01:59 PM at...

    in his "Abyss Server Requirements" post he noted that when he clicks the 'Submit' button he receives various errors and the CGI program doesn't work. David Warner was kind enough to point out that it would probably be necessary to tell Abyss about CGIs through a 'Script Path' entry...

    Hi John,

    have you told Abyss about executable files by creating a 'Script Path' entry?

    Open the 'Abyss Web Server Console' then click on...



    Scripting Parameters...

    Script Paths...


    Set the following...

    Virtual Path: /*.exe
    This struck me as very important so I did likewise.

    However, I still can't get anything to work. When the Abyss Web Server brings up contact.htm and I click the button nothing happens. Nothing at all. I know how the program should work because I tried it on Joe's website. After one fills out the form and clicks the Submit button the brouser somehow passes this line back to the server...


    which is suppossed to call contact.exe. However, on my machine nothing happens. No errors...nothing. In studying Joe's tutorial I found this...

    The main part to examine is the bolded ‘form’ tag. this creates the block of code that informs the server what to do when a ‘submit’ button is clicked. in this case, the data in each of the form fields will be sent to the program called contact.exe that is located on the web server in the document root folder in the cgi-bin directory. This is a standard location for cgi programs to reside, but is totally dependent upon how the web server is configured. the method used to send the data is post...
    When this didn't work for me I examined that line in contact.htm and I suspected that I may have to either change the .htm line to reflect where I had put the Contact.exe program, or create the cgi-bin directory under Abyss Web Server so that my paths coincide with the calls. Well, I tried all that in addition to modifying the scripting path to recognize the added cgi-bin directory...

    Virtual Path: /cgi-bin/*.exe

    ...but all to no avail. Out of desperation I put Contact.exe in every folder in the installation all the way up to \Program Files but this didn't help. Finally, there is a check box in the 'Scripting Parameters' Screen that reads

    "Enable Script Execution"

    I tried with both checked and unchecked but no luck. Also, Shawn Anderson posted a nice simple little example in the fourth post of...

    in answer to a question of Mark Pruitt, but naturally that doesn't work for me either. So at this point I'd surely appreciate if someone could give me some pointers because with my very limited knowledge of this stuff I've pretty much run out of ideas.

  • #2

    Traditionally, all executables and scripting apps go into a separate folder called /cgi-bin/ I normally create this folder under htdocs. The FORM command in the HTML has an 'action=' parameter. The path you put here has to match exactly where the CGI app resides. Remember that the path is relative to htdocs, not the server's root. folders such as \Program Files\ don't exist as far as the web server is concerned. So I would have a structure like this:
    \htdocs\               ---> All html pages
    \htdocs\cgi-bin\     ---> All CGI programs
    The in your FORM line, you'd have something like this:

    <form action=/cgi-bin/myprogram.exe>

    This tells Abyss to execute the program 'myprogram.exe' which is in the sub-folder /cgi-bin/ off the main (root) /htdocs/ folder.

    I'm not in my office at the moment so I can't tell you exactly how to configure Abyss, but you do need to tell it that its "ok" to run CGI programs. I think you might have that correct though.

    Software makes Hardware Happen


    • #3
      Still Working On It...

      Still not having any luck, although that is certainly good to know about \htdocs\cgi-bin. Actually, I had thought of
      that combination and had tried it but I tried it again and double checked to make sure everything else was in order.
      In the scripting configuration parameters dialog I tried both /*.exe and /cgi-bin/*.exe. Still no luck. What surprises
      me somewhat is that one of the options there allows one to specify a cgi log file and I have it specified as...


      The way I have been accessing the contact.htm file is through a double click of it in Windows Explorer. That starts
      Netscape which is my default broser and brings up the form with the text boxes and button. This is what shows in the
      Netscape address box...


      After filling in some data and clicking the button still nothing visible happens. Also, none of the error logs contain
      any data except access.log, which is 1486 bytes as follows... - - [07/Apr/2008:16:41:05 -0400] "GET / HTTP/1.1" 200 0 "" "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)" - - [07/Apr/2008:16:44:19 -0400] "GET / HTTP/1.1" 200 1407 "" "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)" - - [07/Apr/2008:16:44:19 -0400] "GET /favicon.ico HTTP/1.1" 404 403 "" "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)" - - [07/Apr/2008:16:44:19 -0400] "GET /pwrabyss.gif HTTP/1.1" 200 1895 "" "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)" - - [07/Apr/2008:16:45:04 -0400] "GET /htdocs/contact.htm HTTP/1.1" 404 403 "" "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)" - - [07/Apr/2008:20:43:55 -0400] "GET /contact.htm HTTP/1.1" 200 1452 "" "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)" - - [07/Apr/2008:20:44:43 -0400] "POST /cgi-bin/contact.exe HTTP/1.1" 404 403 "" "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)" - - [07/Apr/2008:20:47:56 -0400] "POST /cgi-bin/contact.exe HTTP/1.1" 404 403 "" "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)"

      In \log directory are four log files, i.e., access.log, cgi.log, fastcgi.log, and isapi.log. The server isn't writting anything to cgi.log.

      I'll explore around the Console Configuration Menu to see if there is something else that needs to be enabled that I havn't found yet.


      • #4
        Under "Scripting Parameters" one of the choices is "Script Paths" If I have contact.exe in \htdocs\cgi-bin\contact.exe should that be set to





        Although I've been trying both and neither are working, one of them is certainly right and the other wrong. It would be progress of sorts if
        I could at least eliminate the incorrect one!


        • #5

          In Scripting Parameters Check Enable Scripting Execution

          Then for Script Paths (virtual paths) enter /cgi-bin/*.exe with a Type of CGI

          Then under the Scripting Parameters page again, in Custom Environment Variables Click 'Add'. For 'Name' enter REDIRECT_STATUS and for 'Value' enter 200.

          Save this (just click ok until you're out) and restart the server.

          Then open your browser and enter: http://localhost/Contact.htm

          That should work for you.

          (the reason you have to add the Contact.htm is because the server expects the 'default page' to be named 'index.htm' or 'index.html'. You could rename 'contact.htm' to 'index.htm' and then whenever you enter: http://localhost in your browser, the contact page should appear).
          Software makes Hardware Happen


          • #6

            Joe, you're THE MAN! That did it! You've got my vote even though you haven't come clean yet on what sort of Winter snow reductions/temperature moderations you've got in store for us Pennsylvanians next Winter after the elections!

            Well, now I have something new to play with!

            For any lurkers out there who might want to get into this stuff, a very introductory book I acquired a couple years ago that was of considerable help to me in beginning to understand how internet programming works is Sams Teach Yourself ASP.NET in 24 Hours by Scott Mitchell (2003). With the book comes a cd with Microsoft's Web Matrix Project (which is old stuff at this point, but usable), .NET 1.1, and MSDE. If you are close to completely ignorant of internet programming technologies like I was/am, it might be useful.