Coding Domain

CGI Programming: Installing Perl Programs


Installing a CGI script
To install a CGI script, written in Perl there are some things we you to mention about.

Discussed Topics in this Document


Uploading Scripts
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.

Return to top


About File system Permissions
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: 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: 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.

Return to top


Setting 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 code Filename' 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.

Return to top


Available permissions
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!
LinuxU s e rG r o u pO t h e r
Read
Write
Execute
 
Resulting Mode

Return to top


Commonly used Permissions

Return to top


Receiving errorpages
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.

In some cases, you might also receive a "403 Forbidden" error. Mosty this error is caused by:

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.

Other Questions
Other questions could either be posted at the Discussion Forum [Introduction], or directly to us.

Return to top


Written by Diederik van der Boor at 21 September 2001