CGI Scripting


Please choose from the following questions.

  1. Can I use CGI scripts?
  2. What is a good source of CGI scripts such as Shopping Carts?
  3. What version of Perl are you running?
  4. What is a wrapper CGI script? Does it create any limitations on scripts possibilities?
  5. Will I have access to my own CGI bin directory to run Perl scripts?
  6. What are CGI scripts and how do I use them?
  7. Could you let me have a sample of (insert programming task here) for me to look at?
  8. I would like to call a program written in C from a CGI script. What is the procedure for compiling the code on your machine?
  9. I'm having problems with my CGI script! HHHEEEELLLLPPPP!!
  10. I get the following error message, even trying your demo CGI: "suid attempt aborted! Reason: execve failed - Permission denied"
  11. Do I need to have you activate something so that I can run cgi-bin scripts on my account?
  12. Can we install our own development tools?
  13. What type of forms do you currently have available?
  14. Do you have support for mail forms?
  15. I am using a cgiemail form and keep getting users that appear to be from he.net but when I respond the mail bounces. What is wrong?
  16. Is there a reason the format of my subject line is not working as an HREF? It brings up the web clients mail client, and allows entry of the message. But when 'Send' is clicked, it comes back with an error locating the server " mail".
  17. I was trying to set up an imagemap last night and noticed you have no imagemap.conf in /httpd/conf/...
  18. My previous ISP required me to email the imagemap co-ords for him to place on his server somewhere. What happens at your site? What do I do with the hot-spot co-ords?
  19. Can you run a WAIS gateway script on your server?
  20. Do you have a CGI script designed for credit card processing?
  21. We would like to search a database via a form. Do you offer such a capability?
  22. Is LWP installed?

Can I use CGI scripts?

Yes. You get your own personal CGI bin.

What is a good source of CGI scripts such as Shopping Carts?

Two good places to download CGI scripts is:

http://www.cgi-resources.com

http://www.scriptsearch.com

What version of Perl are you running?

We currently run Perl 5.003. We update it frequently, but anything that works under Perl 5.003 should work under any other version of Perl 5.

What is a wrapper CGI script? Does it create any limitations on scripts possibilities?

It lets us give you the ability to run your own CGI scripts, without compromising our security. There are few, if any limitations imposed by such wrappers (i.e. most of your scripts will work).
 

Will I have access to my own CGI bin directory to run Perl scripts?

Yes.

What are CGI scripts and how do I use them?

They are a way of using programs to both generate web pages dynamically and process user input.

You need to learn a little about how to program in a Unix environment either in C or a script language like Perl.

Could you let me have a sample of (insert programming task here) for me to look at?

We recommend you search for a publicly available example.

I would like to call a program written in C from a CGI script. What is the procedure for compiling the code on your machine?

Log onto the server using telnet and use the compiler GCC (GNU project C and C++ Compiler (v2.4)).

A minor note, just so that you understand the conditions under which we support development: We provide the environment so that you can develop script and programs, you are completely responsible for your development efforts.

I'm having problems with my CGI script. What should I do?

In general, when you are working on modifying an example program, which is now failing but worked when you started, go back to the example exactly, copy it, and then modify it slowly until it stops working, then you will know what you did that caused the bug.

Here are a few things to check:

  1. Be sure to upload your scripts with your FTP client in text mode. Unix uses LF (linefeeds) to separate lines. If you are using DOS it is important the the CR LF to LF translation be done. If you are using the Mac it is important the the CR to LF translation be done. If you use a Unix-style FTP client, type "ASCII" before you send it. If you are using WS_FTP, be sure to click the ASCII radio button (and don't forget to switch back to binary before you download any executables...)
  2. Be sure to set your script to executable. If it is a CGI script use "chmod 700". If it is a script run as a server side include use "chmod 755".
  3. If your script is not a binary executable, check the first line. If your script is a Perl script the first line must be "#!/usr/bin/perl" or "#!/usr/local/bin/perl". If your script is a Bourne shell script you first line must be "#!/bin/sh". If your script is using another shell language check to make sure that the path name specified is valid. Also, make sure an extra blank line didn't get added to the top...
  4. Try to run your script from the command line. This will completely test your function if it does not rely on parameters or environment variables set by the HTTPD. However, many scripts will produce runtime errors when invoked in this manner. If possible modify your script to fail politely when run at the command line so that you can use this technique to check it. Or if your are a more sophisticated programmer write a test script which sets the necessary environment variables and invokes your main script. Even if your script fails when run at the command line if it is a Perl script running it will check it for syntax errors. If it works from the command line, but fails with an error 500 when you call it, it probably is failing to open a file. Are you trying to reference your home directory with a tilde (~) in Perl? That doesn't work...

  5.  

     
     
     

    If suEXEC is enabled in your account and you have a domain name, you can envoke your script directly. If the domain name for your account was bobbywright.com, you would envoke your script with the URL:

    http://www.bobbywright.com/cgi-bin/userscript.cgi

    If you have an IP Address Only account, you can substitute your IP address for the domain name. Please note that suEXEC will only work with a domain name or IP address.

    Make sure to substitute the correct script name, server and account name or domain name in the URL and to be sure to put your script in the directory at:

    /home/username/cgi-bin

    Server side include scripts (the "exec cmd" variety) need to use a full path name to be able to correctly locate your file. For convenience server side includes are usually put in your personal cgi-bin directory. The path name will be something like "/home/username/cgi-bin/userscript".

  6. When in doubt simplify. Reduce the number of subroutines and the amount of code involved to verify that you can invoke your script at all. Then as you can prove that you are getting to a certain point start adding code back in.

I get the following error message, even trying your demo CGI: "suid attempt aborted! Reason: execve failed - Permission denied"

You need to make your script executable. Telnet to your account, cd to he cgi-bin directory, and type:

chmod 700 yourscript

This will correctly set the permissions for your script.

Do I need to have you activate something so that I can run cgi-bin scripts on my account?

No. You already have the complete ability to install and execute your own scripts.
 

Do you offer any kind of search engine so that our customers can perform search amongst a database?

You are welcome to install a CGI script to do this. There are several general database packages for Unix which could be invoked via a CGI script.

Can we install our own development tools?

Yes, in you user directory.

What type of forms do you currently have available?

You can create any kind of form you want. We support user CGI scripting and you can install your own form processing CGI script.

Do you have support for mail forms?

The installed CGI script CGIemail supports forms.

I am using a cgiemail form and keep getting users that appear to be from he.net but when I respond the mail bounces. What is wrong?

Actually what is happening is cgiemail uses a facility called sendmail. Sendmail automatically appends @he.net to the From: line of your message in the absence of a domain name at the end of the from address.

People frequently just enter a user name, or worse, garbage. Further another source of this problem is the use of the comma (",") character. Commas are separators for Internet email addresses but are part of the numbered account names used natively on CompuServe. Knowledgeable CompuServe users know to convert the comma to a period (".") when using Internet email, but every now and then you get somebody that enters (for example):

7281,28817@compuserve.com

This is parsed into 7281@he.net and 28817@compuserve.com. Depending on the context the second address ("28817@compuserve.com") will be discarded.

Add another line to your response for labeled "Email:" and add the same field name as what you use for the From: line so that you will get a copy of the original email address unedited by the mail handling system. Add this to the body of your message. Make sure that there is at least one blank line between your message header, which is treated specially by the mail handling software and the body of your message (to which you are adding this additional line).

Is there a reason the format of my subject line is not working as an HREF? It brings up the web clients mail client, and allows entry of the message. But when 'Send' is clicked, it comes back with an error locating the server mail.

Yes. You need to configure your Web clients SMTP server preference. We will assume you are using Netscape. Select the item Preferences from the Options menu. That should bring up the Preferences window. Select Mail and News from the pop up menu item at the top of the window. Enter your pertinent information where it says mail. Be sure to enter a valid SMTP server, if you don't know what the name of the mail server your current provider has running you can enter mailout.he.net. Click Ok. Now you can send mail using Netscape.

The second cause for your problem, if you have already done the above, is that your providers mail server went down.

I was trying to set up an imagemap last night and noticed you have no imagemap.conf in /httpd/conf/.

We use a version of imagemap that eliminates the need for users to change a central configuration file. Every user can add their own imagemaps at their discretion without intervention from us.

My previous ISP required me to email the imagemap co-ords for him to place on his server somewhere. What happens at your site? What do I do with the hot-spot co-ords?

You have complete and total control over your imagemap files.
 

Can you run a WAIS gateway script on your server?

Yes you could, provided you obtained the script and installed it yourself.

Do you have a CGI script designed for credit card processing?

The installed CGI script CGIemail supports forms in which people can enter their credit card numbers. You may also use one of the many publicly available scripts or you can have a script developed custom for your application.

We would like to be able to seach a database via a form. Do you offer such a capability?

We have mSQL, an SQL type databse installed. There are many different publically available CGI frontends available for it. An mSQL database is included with all accounts. Your database name is the same as your account name.
 

Is LWP installed?

You are welcome to install your own set of additional modules.

When you build modules, use the PREFIX option when generating Makefiles:

perl Makefile.PL PREFIX=/home/mydir/perl

then either set the PERL5LIB environment variable before you run scripts that use the modules/libraries (see the perlrun manpage) or say:

use lib '/home/mydir/perl';