Jump to main contentmickwood.com - Website Hosting & Design for Christian Organisations
Support

"If we don't know it's broken we can't fix it!"

Support FAQ Homepage

Can't find the answer?

CGI / Perl & Server Side Includes (SSI)

  1. How do I chmod my scripts?
  2. How do I install a Perl module?
  3. How do I prevent other sites from linking directly to files on my web site?
  4. How do I tell the web server to parse my files that include Server Side Includes?
  5. How do I use Server Side Includes?
  6. 1. Where is my CGI-BIN?
    2. Can I execute custom CGI scripts on my web site?
    4. How should I set file permissions in a Perl script?
    5. How do I set up crontabs?
    6. What is the location of sendmail?
    8. What is the path to my site?
    9. What is the path to the date program?
    10. What is the location of the Perl 5 libraries?
    11. How do I install a perl module that mickwood.com does not have installed?
    12. Where is the best place to download CGI scripts?


1. How do I chmod my scripts?

In the File Manager:

  1. Login to your control panel(http://www.yourdomain.com/cpanel)
  2. Click on the "File Manager" icon
  3. Navigate to the directory where the file is located that you want to chmod
  4. Click on the current number in the permissions column (usually 0644)
  5. Click the 'Save' button

In CuteFTP: When connected to your site, right click on the file you want to chmod, click 'CHMOD' from the popup menu, set the permissions and then click 'ok'.

In WS-FTP: When connected to your site, highlight the file, right click the file, select 'CHMOD' from the pop-up menu, select any of the options and click the 'OK' button.

In SmartFTP: When connected to your site, left-click on the file or directory to highlight it. Then right-click and a pop-up menu will appear. Now choose "CHMOD" and type in the number manually or use the check boxes.

Back to top


2. How do I install a Perl module?

Send an email to mick@mickwood.com with your domain name and the Perl module you need to be installed. We will be happy to install the Perl module for you.

Back to top


3. How do I prevent other sites from linking directly to files on my web site?

Overview

HotLink protection prevents other web sites from directly linking to files on your web site. Other sites will still be able to link to any file type that you don't specify below (ie. html files). An example of hotlinking is using a <img> tag to display an image from your site from somewhere else on the net. HotLinking files on your web site ensures that no other site can steal your bandwidth. You should ensure that all sites that you wish to allow direct links from are in the hotlink list. The system attempts add all sites it knows you own to the list, however you may need to add others.

Configure HotLink Protection (in Security section of cPanel)

Steps

  1. Enter all the URLs you are allowing to HotLink to your web site in the "URLs to allow access" text box.

NOTE: If any default URLs should not be entered in the text box, delete them accordingly.

  1. Next, enter file extension types in the "Extensions to allow (separate by commas)" tex box. By default, "jpg,jpeg,gif,png,bmp" are automatically entered.
  2. If someone tries to visit a section on your web site that you have HotLink protected, you can setup a Redirect URL to point them to another location. Enter the URL you want the visitor to be redirected to in the "Url to Redirect to" text box.
  3. If you want to allow direct requests to view image files on your web site, ie. http://www.yourdomain.com/cpanel.gif, click on the Allow direct requests check box.

NOTE: The "Allow direct requests" checkbox must be checked when using HotLink Protection for files that you wish to be viewed in QuickTime (Mac Users) by your site's visitors.

  1. Click on the Submit button. This will save all changes you have made in the steps above.
  2. Enable your HotLink Protection by following the instructions below.

Enabling HotLink Protection

By default, HotLink Protection is disabled. To enable HotLink Protection, click on the Enable button next to "HotLink protection is currently disabled." When the page loads, you will see a confirmation statement.

Back to top


4. How do I tell the web server to parse my files that include Server Side Includes?

Make sure the names of your files end with ".shtml" or ".shtm".

For example:

index.shtml or index.shtm

Back to top


5. How do I use Server Side Includes?

Use the #include directive to include files in your current html documents. The "file=" or "virtual=" elements can both be used.

For example, let's say you were trying to include doc1.html in doc2.html. Both documents exist in a directory called "docdir". Below is the code that you would insert in doc2.html.

File Include Method:

<!--#include file="doc1.html"-->

Virtual Include Method:

<!--#include virtual="/docdir/doc1.html"-->

Back to top


1. Where is my CGI-BIN?

You can execute CGI & Perl scripts from any location inside of your web space. Many people create a directory called 'cgi-bin' and store all of their cgi scripts inside it to keep track of them.

Back to top


2. Can I execute custom CGI scripts on my web site?

Yes, you can install almost any CGI script you can get hold of. We provide access to the standard Perl 5 libraries and modules.

Back to top


3. How do I use Server Side Includes?

Use the #include directive to include files into your current html document. The "file=" or "virtual=" elements can both be used. You should choose Virtual as we use an Apache web server. (This is the default choice in Dreamweaver.) In Apache, Virtual works in all cases, while File works only in some cases.

For example, let's say you were trying to include extra.html into news.html. Both documents exist in a directory called "docdir" in your main htdocs area.

< !--#include file="extra.html" -->
< !--#include virtual="/docdir/extra.html" -->

Give the file a filename that ends in ".shtml" to tell the server to interpret your SSI.

Back to top


4. How should I set file permissions in a Perl script?

Very often permissions are set very leniently in order to avoid any permissions problem. This is not a good idea. Your Perl scripts should have the appropriate permissions depending on the function of that particular script.

First, all scripts should be set to the owner (you) having read, write and execute privilege (rwx) regardless of the function of the Perl script.

Next, you should ask yourself if you want people (visitors) to your website to be able to execute the Perl script. This is most likely the case. Under these conditions, your script would be set to world readable and executable (r-x). Do NOT give the world write permission on the Perl script. It is not necessary and may lead to problems.

If your script is not going to be executed through the web and only you will be executing the script through Telnet (there are various reasons for having a script operate under these conditions), then you set the script to no world permissions (---).

The group permissions should be set to read and executable (r-x) if the script is to be executable via the web. Otherwise, set your group permissions to nothing (---).

With this information, you have the following permissions breakdown:

Executed via the web by anyone: chmod 755
Executed by only yourself thought the command line: 700

Often times, a Perl script will open a file for writing. This is the case in guestbooks and bulletin boards, where the information is received from the form and written to a certain file. The permissions of this particular file are very important.

Finally, never set your file permissions to rwxrwxrwx, or chmod 777. This is not necessary and may cause a security problem on your website.

Back to top


5. How do I set up crontabs?

Just send an email to enquiries@mickwood.com with the following information:

1 - The full path to the script(s) you need executed.
2 - The time(s) you need it (them) executed.

Back to top


6. What is the location of sendmail?

The location of sendmail is /usr/sbin/sendmail

Back to top


8. What is the path to my site?

/home/username/public_html

Your username is generally (but not always) the first 8 letters of your domain name. Check your welcome letter for your actual username.

Back to top


9. What is the path to the date program?

/bin/date

Back to top


10. What is the location of the Perl 5 libraries?

When using Perl/GGI scripts make sure that the first line of your Perl/CGI script has the following:

#!/usr/bin/perl

Occasionally you may need to put the following (depending on the script):

#!/usr/bin/perl --

Back to top


11. How do I install a perl module that mickwood.com does not have installed?

Since you do not have admin access to install perl modules, just send an email to enquiries@mickwood.com with the name of module that you need installed. One of our support staff will install the perl module for you.

Back to top


12. Where is the best place to download CGI scripts?

Three excellent places to download CGI scripts are:-

http://www.cgi-resources.com

http://www.hotscripts.com

http://nms-cgi.sourceforge.net

Back to top


welcome | name | hosting | design | content | promote | update | showcase | support | general information

Showcase Update Promote Content design Hosting Name Welcome