CGI
Q1. Where do I put my CGI scripts?
Q2. How do I make a CGI file executable?
Q3. What is the path to Perl?
Q4. What is the path to Sendmail?
Q5. Is it possible to make the default index page a CGI script?
Q6. My CGI file returns the error message, "Forbidden. You don't have permission to access /support/test.cgi on this server."
Q7. My script runs fine, but it can't find any data from the submitted form.
Q8. How do I include the output of a CGI script in a server-parsed HTML file (server-side include)?
Q1. Where do I put my CGI scripts? You may put your CGI scripts anywhere you wish. Any file that ends in .cgi or .pl and is marked executable will be treated as a CGI file. Howeverm for security reasons, we strongly recommend that you put your CGI files in /home/httpd/cgi-bin (these file are accessed on the web through the URL http://www.yourdomain.com/cgi-bin/cgi-file, where "yourdomain.com" is your site name and "cgi-file" is the name of the CGI file. This is because the contents of files in this directory cannot be viewed by others. [BACK]
Q2. How do I make a CGI file executable? After you upload your CGI scripts, login to your site administrator control panel. Go to File Manager and navigate the directory tree to find your CGI file. Click on the picture icon next to the file and you will then be presented with the option of making it world executable. [BACK]
Q3. What is the path to Perl? /usr/bin/perl [BACK]
Q4. What is the path to Sendmail? /usr/sbin/sendmail [BACK]
Q5. Is it possible to make the default index page a CGI script? Yes. If there is no index.html file in your directory, the web server will automatically run index.cgi instead. [BACK]
Q6. My CGI file returns the error message, "Forbidden. You don't have permission to access /support/test.cgi on this server." All CGI files must have executable permissions enabled. There are three ways to fix this problem.
- The easiest solution is to point your browser to
http://yourdomain.com/admin, where yourdomain.com is
your real website's domain name. Once you log in, go to File Manager and navigate to the location of your CGI script. Next, click on the picture icon next to that file. A permissions screen will then appear -- check off all three execute boxes and save your changes.
- Alternately, if you have telnet/SSH access, you can issue the
command chmod 755 file.cgi, where file.cgi is the name
of the CGI file.
- Finally, your third option is to set executable permissions via
FTP, by issuing the command site chmod 755 file.cgi in your FTP
client, where file.cgi is the name of the CGI file. Note that
not all FTP clients support this command.
[BACK]
Q7. My script runs fine, but it can't find any data from the submitted form. In your HTML form, make sure the action value does not contain "http://". For example: <FORM METHOD="POST" ACTION="/myform.cgi"> is the preferred syntax. If you are calling your form from another site and absolutely must include the http:// portion, you must make sure you specify the fully qualified domain name. http://yourdomain.com/form.cgi will NOT work.You must use http://www.yourdomain.com/form.cgi instead. [BACK]
Q8. How do I include the output of a CGI script in a server-parsed HTML file (server-side include)? This is one of the more common uses of server-side includes. To include the output of a CGI program, such as a hit counter, add code similar to the following in your HTML file:
<!--#include virtual="/cgi-bin/counter.pl" -->
In addition, your HTML file must end in .shtml instead of .html, or the permissions on the file must be marked as executable. [BACK]
|