Getting Started / CGI FAQ
- What paths to server resources should I use in my CGI or PERL scripts?
- Where do I put my CGI scripts?
- How do I use FormMail?
- Why am I getting the "Server: Error 500" message?
- What file permissions do I need for my CGI script?
- How do I run my own CGI programs?
- 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?
2. Where do I put my CGI scripts?
Here are the correct paths to the common server resources that CGI scripts often require:
Path to Perl interpreter: #!/usr/bin/perl
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)
3. How do I use FormMail?
Put your cgi-bin scripts in the public_html subdirectory named "cgi-bin".
4. Why am I getting the "Server: Error 500" message?
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.
5. What file permissions do I need for my CGI script?
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.
6. How do I run my own CGI programs?
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.
7. How do I look at my website before the DNS switches?
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
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 email@example.com