Getting Started / CGI FAQ


  1. What paths to server resources should I use in my CGI or PERL scripts?
  2. Where do I put my CGI scripts?
  3. How do I use FormMail?
  4. Why am I getting the "Server: Error 500" message?
  5. What file permissions do I need for my CGI script?
  6. How do I run my own CGI programs?
  7. How do I look at my website before the DNS switches?

1. What paths to server resources should I use in my CGI or PERL scripts?

Here are the correct paths to the common server resources that CGI scripts often require:

Date:   /bin/date
Sendmail:   /usr/lib/sendmail
Path to Perl interpreter:   #!/usr/bin/perl
Serverpath:   /home/username/public_html/cgi-bin
Root path:   /home/username/ (puts you in the root of your account)
Domain directory:   /home/username/public_html (puts you in your public_html directory)
Cgi-bin path:   /home/username/public_html/cgi-bin/filename (puts you in your cgi-bin)

2. Where do I put my CGI scripts?

Put your cgi-bin scripts in the public_html subdirectory named "cgi-bin".

3. How do I use FormMail?

There are two form to email scripts in Cpanel, cgiemail and FormMail clone.

For more information on how to set it up, refer to our forums at http://forums.canadianwebhosting.com/viewtopic.php?t=54.

4. Why am I getting the "Server: Error 500" message?

500 errors are typically something wrong in the syntax of your script. Most often you should check to make sure you have the path to PERL correct. Currently we are running Perl5.6+ on our servers.

The correct path to PERL is: #!/usr/bin/perl

If you are using FrontPage to create your site, you may need a different solution.

5. What file permissions do I need for my CGI script?

CGIs must be set with executable file permissions, or requests for the script from the web server will result in an Internal Server Error. Scripts that need to be executable should have their permission set with chmod 755. This sets the file's permissions so that the file's owner may read, write, and execute the file; and anyone else can only read and execute it.

6. How do I run my own CGI programs?

Put your CGI programs inside the cgi-bin directory. Make sure you upload them in ASCII mode. Change permissions to 755 for the script (chmod 755 scriptname). Access them via http://www.yourname.com/cgi-bin/scriptname

7. How do I look at my website before the DNS switches?

Type http://ip-address/~username in your web browser replacing username with your actual username and replace ip-address with ip address containted in the welcome email.

 


As always, if you need any help at all, feel free to email us at support@canadianwebhosting.com















Green Business Bureau Member Seal