Home | About Us | Contact Us   
 

How to use CGI scripts:

In order to use CGI scripts, you just need to make sure the following conditions are met for the file:

  • It has an extension of .cgi
  • It is an executable file, with file permissions allowing read and execute access to everyone, e.g:
    chmod go-w+rx filename.cgi
  • It can reside in any directory inside your pubhtml directory, but preferably, you should create a directory, called something like cgi-local, and put all your CGI scripts there, e.g.:

    cd ~/pubhtml/
    mkdir cgi-local

As long as all the conditions above are met, your CGI script will automatically be treated as such by the web server.

Things to watch for:

  • If you are using Perl to write your CGI scripts, and using FTP to transfer files from a Windows, DOS or Mac computer, you MUST use ASCII mode transfers. This is so because UNIX has a different linefeed character, as opposed to the systems above.
    • Alternatively, you can use dos2bsd program to convert your files after you have transferred them onto the server.
  • Perl executable is in /usr/local/bin/perl and that should be referenced in your Perl scripts.
    • Current installed version of Perl is 5.004_04. Online documentation for Perl is available at http://www.perl.com/
  • If your scripts fail with an error like "500 Internal error" -- most probably it means that there was an error with the script itself, and not really a server misconfiguration. Debug your script.
  • If you have a virtual host on Binary Net, make sure you do NOT call your CGI directory cgi-bin -- the server will go to the system CGI directory, and not to yours. Call it anything, but cgi-bin
  • It is generally a good idea to try to troubleshoot CGI scripts running them from shell, e.g.:
    ./yourscript.cgi
    • However, doing so may take some knowledge about the way web server is executing CGI scripts, that is, you would need to manually set up correct environment variables, etc. -- what web server does every time it executes your script.
  • sendmail is located at /usr/sbin/sendmail, not /usr/lib/sendmail as some scripts assume. This is pretty much a standard place for it on BSD Unix. Specifying a wrong place may cause simple scripts to bomb out and die, resulting in a 500 Internal server error.

Please contact support@binary.net if you have any further questions. Unfortunately, though, our limited resources will not allow us to help you in troubleshooting potential problems with your CGI scripts.

 
Copyright © Binary Net 1996-2005