On our servers, you may place your cgi-programs in your public_html directory, or any sub directory within your site. However, they are most secure, inside your cgi-bin, or if you use the cgi-wrappers feature from the control panel, it will create an scgi-bin. The scgi-bin runs all scripts within it, under your user name, instead of as nobody. This is helpful for many different things, and is available if you need it for your scripts.
Installed Perl Modules
If you are needing to install a script, but need specific modules for it to run, you can look to see all the installed modules from your control panel. Look at the left side column, and you will see below the path to perl, and sendmail, a link to view the installed modules. If what you are looking for is not there, please contact admin@superior-host.com to see if it can be installed for you. Most are simple to install, some others are too large, or require too much system resources. Others may have a small one time fee if it is not an easy module to install. Many scripts that need a special module to run, will come with a test script for you to run. It will show if the modules are already loaded or not.
Path to Perl
One of the first things you will need to know, is your path to perl on our servers.
This goes on the first line of every script. On our servers, it is: /usr/bin/perl
In your control panel, it shows the path to perl for the machine Your site is on, and the path to sendmail , for easy reference.
Path to Sendmail
Many programs which send e-mail will need to know where the Sendmail program resides on the server. The script will typically have a setting like this: $mailprog = '/usr/sbin/sendmail'; and will want you to set it appropriately. Sendmail on our servers can be found here: /usr/sbin/sendmail
Setting Directories and Root Paths
When you configure a cgi script for "any" server, it may ask you to set variables such as the base, relative, and CGI directory/url settings. Here is an "example". Of course, each script may vary, but this should provide you with some basic idea:
$basedir = "/home/yourUsername/public_html/forum";
$baseurl = "http://www.yoursite.com/forum";
$cgi_url = "http://www.yoursite.com/cgi-bin/tgsforum.pl";
The Basedir, is the base directory. This is the root or server path to the folder containing your script.
The Baseurl is the web browsers way to your base directory.
The CGI_URL is the actual url calling the script, like if you were using your web browser to go there.
Most scripts come with documentation on how to set these directories. Please make sure you read and understand it before configuring the script.
New to cgi? Here is a couple of pages with tutorials and training on using cgi scripts: http://www.bignosebird.com has some great tutorials for HTML and Perl scripting. Another excellent site, which provides step by step chapters is: http://www.cgi101.com/class/ , it is great to learn beyond the basics and teach you how to actually write perl scripts.
This is important, because if you ever need to customize a script a little for your needs, you need to understand what makes them work. These two above, are two great starting points to learn perl cgi programming basics.
File Permissions
Understanding file permissions, and how they affect your scripts, and their security are important. I will touch on the basics, but to fully understand them, you should follow some of the on line tutorials at the sites I mentioned above, or get a book on perl scripts.
Owner Permissions:
You (your site) is the owner. You gain access to your ownership by logging in via FTP, telnet (SSH), or through your control panels File Manager. Giving the owner permission to read and write is usually important - other times, the script may set up files that you can't work with through your user name and password.
Group Permissions:
This is a group of users who have access to a particular directory. For example, a password protected directory, where only members can access it upon providing the correct Username and Password. In this case, any permissions you assign to "Group" would be applicable to all users with access to that particular directory. You however, as the owner may not have the restrictions you set on the other users. You may be able to write to files, where they can only read, etc.
World Permissions:
Pay Attention here! This is the most important one. world permissions determine what your world wide visitors can and cannot do with your files. ALWAYS make sure you understand what a particular permission does before assigning it to a file. If you don't, you may wake up to find your website hacked by some clown who was snooping around and gained access to your files.
How to change or set Permissions
There are a few ways to change your file permissions. FTP, Telnet, and through your control panels File Manager. I will try to explain them each, but remember, all FTP programs are a little different, and some may not have this ability at all - Most do.
FTP:
You can log into your site by FTP, and move to the directory your scripts are in. If you don't know how to do that part, then stop reading, and learn FTP first, or have someone else put in your scripts for you. You can mess up your whole site in FTP if you don't know what you are doing.
Ok, back to FTP.
Log into your site by FTP, and move to the directory your scripts are in. Right click on the file you need to change permission on. This should bring up a menu. Select CHMOD , or Unix commands, then CHMOD. You should then get a box that allows you to either check boxes or write in the number you need; ie - 644, 755, etc.
Usually, when you FTP your files to the server, your permissions setting is 644. This will not let most cgi programs run, so you have to set the permissions so they can perform the functions they need to do. The program or script that you are trying to install, should tell you what permission settings it needs for the various files. Set them, and if all else is correct, the script should function. If not, check your sites error log in the stats link from your control panel and see if it gives you a good reason why it is not working.
Telnet - SSH (secure telnet)
I will not go into much detail in telnet instructions. If you do not know how to use SSH or telnet, then this is not the place to learn. You can destroy your site if you do not know what you are doing.
To change or set your file permissions in telnet, you need to move to the directory where the files are located. Then, list them so you can see the proper and exact spelling for your files. then, CHMOD your files to the setting that the scripts install directions tell you to.
This is not for users with no SSH experience. I will write a tutorial, or find a good one to point you to for learning how to... I will post it here, or on the main page of this support section when it is ready.
Control Panel File Manager - setting permissions
It is pretty simple to set the permissions from your sites control panel. For those of you that do not know how to use SSH/telnet, or if your FTP program will not let you change the permissions, then here is the other way you can do it.
Go into your control panel, and click on the File Manager link to open a new window for your file manager. Next, you will see folders and perhaps a few files... just like when you FTP into your site. Moving to the correct place is easy,,, just a little different.
To move into your public_html directory, click on the folder Icon beside the words public_html. Clicking on the Icon will take you inside a folder. Clicking on the words of an file or folder brings up property lists of things you can do to that file or folder.
Ok, now that you are in your public_html folder, do the same to get to the cgi program you are working with. You can see the list of files and their current permission setting is on the far right of that column. Once you can see the files names that need changed, click on the file name. This will bring up a list of options in the upper right area of your screen. Click the one that says, change permissions.
Now, you see a box just like the one you may see in an FTP program. You have a set of check boxes. As you check the boxes, you will see the numbers below it change. You can also just change the numbers in the box to what you need. Once you have set the number or check boxes, just hit the submit button.
Repeat that for each file you need changed. It works the same way for folders if you have a folder that needs special permissions, you can set it the same way.
Please be sure you understand the file permission settings. You do not want to give the world permission to destroy your site. If you are new to cgi, please refer to some tutorials or beginners sites like http://bignosebird.com and others, to learn how to master your website.
Top
Back to Basic's page