Cpanel $5 Hosting - Virtual Private Cloud Hosting - ColdFusion Hosting ASP.NET - CPanel Linux PHP Hosting - Dedicated Servers - Reseller Hosting
Q: Do I need to change the file permissions on my CGI script?

In order for you to run scripts in a UNIX environment, you will need to ensure that execute permissions are given to the script. File and directory permissions can be represented by a 3 digit number UNIX, and generally the correct permissions setting for a CGI file is 755 - the same as your cgi-bin. By default, the file permissions for any file that you upload to your Web site directory are set to 644 by the FTP server. This setting does not assign the proper execute permissions to the web server, and thus the script will not function properly unless the permissions for the file are changed to 755. For more information on the UNIX file and directory permissions structure, please see the following links:

http://www.bignosebird.com/unix.shtml

You may grant execute permissions and generally change the permissions for your CGI scripts and other files by using your FTP client. Simply login to your account with your FTP program, access your cgi-bin and then right click on the CGI file in question. In most FTP programs, this should generate a menu of options - one option should be either "properties" or "change file attributes". Once you select one of these options, you may assign the proper execute permissions to your script by either entering 755 or checking the execute permissions setting for the anonymous or "other" group. For additional information on granting execute permissions using your particular FTP program, please search under the help section of the program for "file permissions".

Once you have successfully changed the permissions for your CGI file, please make sure that you follow the additional guidelines in configuring your script.


Additional CGI Information...


In our UNIX environment you may use scripts written in Perl that make use of the .cgi and/or .pl extension. All you need to do is upload the script to your CGI-bin in your directory - make sure that you upload the script in ACSII (text) format, as Perl is a text language and not a binary programming code like C. Please make sure that you place the path to Perl at the very top of your script so that it will be mapped to the Perl interpreter for execution. The path to Perl is:

/usr/bin/perl

and you will need to place the syntax:

#!/usr/bin/perl

at the very top of the cgi script file.

The permissions are already properly set to 755 with the CGI bin. However, you will need to chmod 755 the Perl file so that it becomes executable. You may do this by right clicking on the file in any FTP program and selecting "change file attributes" or "properties". There may be a field where you can manually enter the number "755" to represent the proper permissions. Otherwise you may simply give the three users the following permissions:

user (yourself): read, write and execute

group: read and execute

other: read and execute

Below, we have pasted links to some helpful CGI resources:

http://www.perl.com/reference/query.cgi?tutorials - a helpful Perl tutorial/help section

http://www.perlclinic.com - professional Perl help

http://www.bignosebird.com - intro level cgi tutorials

http://www.cgi101.com/class/ - intro level cgi tutorials


We hope this information helps! Please let us know if you have further questions.


-- return to questions ID: 152
OnlineCorp.com Web Hosting -- QuickCart.com Shopping Cart
QuickCart Shopping Cart - Dedicated Servers - Reseller Hosting - Register Your Domain - ColdFusion Hosting
Online Corporation of America
Website Hosting
 -  Quick Cart Shopping Cart Store Builder - By Design Templates  
 Site Map  - Contact Us -  Privacy Policy

Sales & Support: 570-686-2300    Sales@Onlinecorp.com