Script Tips

These are a few tricks you'll find helpful to know when installing scripts.

ASCII mode
CGI and PHP scripts always need to be uploaded in ASCII mode. This means that it is uploaded as straight text, not as binary code, like an MP3 or an image. If you're not sure what to do, make sure your FTP program is set to "Auto Mode" or "Auto Detect." That way the FTP program will check the file extension to see whether it should be uploaded in ASCII mode.

CHMOD
"CHMOD" is a utility to set the mode (CHMOD = CHange MODe) of a file or directory. The mode dictates who on the system may access a file. The mode is also known as "permissions." Most, if not all, CGI scripts need to have their permissions changed, unless you're on a Windows 2000/NT system.

Usually a CGI script is CHMOD to 755. To do this in an FTP program, right click on the file and select "CHMOD" or "Properties," depending on which FTP program you're using.

What do the numbers mean?

  • 777: all can read, write and execute.
  • 755: owner can read, write and execute, group/others can read and execute.
  • 666: all can read and write (known as "world writable").
  • 644: owner can read and write, group/others can read only.

Path to Perl
For all CGI scripts you will need to know the path to Perl on your server. This varies from server to server, so you'll need to contact your web-host and ask them, although usually hosts have an FAQ on their site where they've given the information already. If you have Telnet or SSH access, connect to your account and type whereis perl. The usual paths to Perl are #!user/bin/perl or #!/usr/local/bin/perl.

Path to Sendmail
Your script will need the path to Sendmail if it sends out emails at all. This also varies from server to server, but it will be something like /usr/sbin/sendmail or /usr/lib/sendmail.

To find out your server paths to Sendmail and your web directories, which are also sometimes needed, you can use a script like PerlDiver, which will find them automatically for you. You will need to know the path to Perl to run it.

Escaping Characters
In most scripts, you'll find that if you enter a stray " or @ when customising the code, you'll get a dreaded Internal Server Error. If you ever need to add one of those characters, escape it with a forward slash.

For example: $email = "kali\@xentrik.net";

This tells the script that is is a real @, and not a part of the script code, which uses @ and " for other purposes. It's like adding < and > to HTML; it confuses the code.