Please Note: Support for CGI usage is only available for domain hosting accounts.To use your own CGI's in your web site you first must create a directory in your public_html directory called cgi-exec. In here is where all your CGI's must go. All CGI's that you put in here must end in .cgi.
The CGI's that you upload here must be executable by the web server. To do this you must ftp to the server and change the permissions (with the file permission or CHMOD function of your ftp program) of your file. it should be set to chmod 755 or -rwxr-xr-x. Please check our FTP file permissions instructions at the bottom of the page for more information.
To call the CGI's directly just use the URL like: www.domain.com/cgi-exec/script.cgi
(put your domain name where we have domain.com)When writing your CGI keep in mind to change the path at the top of your Perl or PHP scripts to the correct one. PHP scripts must have #!/usr/local/bin/php at the top of them. Below is the path information commonly used for CGI's
Perl: /usr/local/bin/perl
PHP: /usr/local/bin/php
Mail: /usr/bin/mail
Sendmail: /usr/lib/sendmail
When printing to the screen you must make sure you include a content-type so the server knows how to process your output. You should use something like this:
print "Content-type: text/html\n\n";The full file name path to your cgi directory (replace "username" with your username"). is one of two things, depending on whether you account was created before or after June 1999 (if it doesn't work one way, try it the other way, as your directory structure may have been moved)
Before June 1999:
/export/home/username/public_html/cgi-exec/script.cgiAfter June 1999:
/export/home/u/username/public_html/cgi-exec/script.cgi
This means that after /export/home/ you put the first letter of your username, then another / then your username and the continue with the normal public_html etc.Also you must make sure you have the correct permissions set on your file. You'll want CHMOD 755 to allow execution by the web server. In WS_FTP you can right click on the filename and change this option and in Fetch you go into the Remote directory and choose Set Permissions.
Galaxy cannot provide support for any cgi's that you upload to your cgi directory.
File permissions are what control your users ability to modify, or execute a file on your web site. Normally the default permissions are fine, where the world can read the file in your site, but only you have the ability to write to the file. When you want to use a CGI or guestbook type program where it takes information from the user and writes it to a file or executes a CGI you'll need to make sure the web server user has the ability to do what they need with your file. For CGI's this usually means that the web server has execute ability for your CGI file, and for something like a guestbook the world must have the ability to write to the guestbook file so they may leave comments. Often if you are installing a public domain or shareware CGI into your site it will come with instructions that will tell you what permissions to assign to the executable CGI and different supporting files. Below are some quick instructions for common FTP programs on how to modify file permissions. For more indepth instruction please check with the software maker.
Windows: WS_FTP
Right click on the file you want to modify. Choose the CHMOD function.Windows: CuteFTP
Right click on the file you want to modify. Choose the change file attributes function.Mac OS: Fetch
Hilight the file you want to modify. Go to the Remote menu and choose Set Permissions.Mac OS: Transmit
Hilight the file you want to modify. Go to the File menu and choose Get Info.