Any CGI script should be uploaded in ASCII modes. This makes sure some ASCII character conversions are being made, with for example the end-of-line codes.
Most web servers require the script into a special scripting directory, usually named cgi-bin.
If it doesn't exist you can always create it, and you properly need to change the permissions into 777 or 766.
Some scripts will try to create data files, and those directories where they are put files in should also have the permissions 777 or 766.
Any UNIX based system, unlike most Windows versions, uses access permissions to the file system.
These permissions are used as security precautions. There are thee levels of access a permission
can be defined for, which are:
User Access
Group Access
Other Access
Every group can be restricted, so they can't do some things with files located at the web server.
Access types, which can be restricted are:
Read access
Write (change) access
Execute access
Theoretically, you can disallow anyone from doing something anything with a file,
or disallow anyone from editing the file, except for yourself!
You can even disallow some persons from executing a program file which simply implies the program can't be run by that specific user.
The last option is very required for a CGI program! But then, you don't want anyone else to
modify (write to) your program. All these things is taken care of by the file permissions.
To set the file permissions, you can use your FTP program. Most of these programs have a
'Change Permissions' option. For anyone who works in a command-based FTP program,
you should send the literal code 'SITE CHMOD Mode codeFilename' to the web server.
For example in the MS-DOS FTP program, you usually need to type literal SITE CHMOD 755 myscript.cgi in
order to change the permissions for the file myscript.cgi into 755.
Web servers running windows don't support this off course, because it's not required in Windows.
You can use this panel to find out which mode you should use to set the file permissions like you which to.
Note that a CGI script should be readable (by the Perl interpreter), if you want to execute it!
If you receive a "500 Internal Server error", you need to run a checklist for yourself.
This is mostly the error you receive when installing a CGI script.
Are the files uploaded with the right mode? (ASCII or BINARY)
Are all files in the right folder?
Did you spell the filenames correctly, also using the right case?
Are all file permissions set correctly? (UNIX only)
Do all data folders have the right permissions, so the script can create files if it has to? (UNIX only)
In some cases, you might also receive a "403 Forbidden" error.
Mosty this error is caused by:
An attempt to execute a script what isn't allowed to execute. Check the execute permissions.
The fact the source of the CGI script can't be read by the webserver. If no one can read the
script source, the interpreter also can't parse the file.
Some webservers don't allow CGI scripts to execute in a directory that doesn't have enough
restrictions set. Make the directory permissions more strict, so the CGI script can't do anything in that directory.
An attempt to list the contents of the directory. (also called "execute directory as script")
Might occur when your request line doesn't include a filename, but only a directory path
If you receive a error page, but generated by the script, check error message first.
That might get you a clue what's wrong with a file. Use the previous checklists aswell.
Maybe you can even access the error log file of the webserver. That log definitefy holds the error.
In the worst case, the error isn't caused by your configuration, but by the script.
A syntax error or programming trick that isn't compatible with your interpreter
might happen sometimes, how unfortunate it is. If this happens, and you're sure you still want
to use or try the product, contact the author. Explain him your situation and configuration.
That will help you out of your problem, but also improves his product.