CGI and Server Side Includes


Information and overviews on Server Side Includes (SSI) and Perl.

•» Where is my CGI-BIN?
•» Can I execute custom CGI scripts on my web site?
•» Where is the best place to download CGI scripts?
•» How do I debug my CGI scripts?
•» How do I use Server Side Includes?
•» How do I setup a members only pop-up password box?
•» What is the path to my site?
•» What is the path to the date program?
•» How should I set my file permissions on a Perl script?
•» How do I CHMOD my CGI and Perl files with CuteFTP?
•» What program can I use to setup a mailing list for my users?
•» What is the location of sendmail?
•» How do I setup crontabs?
•» What is the location of the Perl 5 libraries?
   
»•« Where is my CGI-BIN? -

  You can execute CGI scripts from any location inside of your web space. Although most people create a directory called 'CGI-BIN' and store all of their cgi scripts inside of it to keep track of their scripts.

- Updated: Saturday, March 02, 2002
   
»•« Can I execute custom CGI scripts on my web site? -

  Yes. You can install almost any CGI scripts you can get your hands on. We provide access to the standard Perl 5 libraries and modules.

- Updated: Saturday, March 02, 2002
   
»•« Where is the best place to download CGI scripts? -

  A very good place to download CGI scripts is http://www.cgi-resources.com

- Updated: Saturday, March 02, 2002
   
»•« How do I debug my CGI scripts? -

  In order to debug your cgi scripts add a 'd' to the end of the cgi/pl extension.

Example:

script.cgi will change to script.cgid
and
script.pl will change to script.pld

Then go to the script in your browser. You will then be able to easily debug your scripts. Once you have debugged the script change it back to it's old name and it should work fine.

- Updated: Saturday, March 02, 2002
   
»•« 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. For example, let's say you were trying to include doc1.html into doc2.html. Both documents exist in a directory called "docdir" in your main htdocs area.

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

Be sure to do the following to tell the server to interpret your server side includes:

Give the file a filename that ends in ".shtml"

- Updated: Saturday, March 02, 2002
   
»•« How do I setup a members only pop-up password box? -

  1)Create a files called '.htaccess' with

<-----copy below here----->
AuthPAM_Enabled off
AuthUserFile /path/to/.htpasswd file
AuthGroupFile /dev/null
AuthType Basic
AuthName "Members Area"
require valid-user

<-----copy above here----->

in it. Upload that to the directory you want protected. It will disappear because it is a hidden file.

2)Upload a file called '.htpasswd' where ever you want.

3)Upload 'access.cgi', download it from here http://www.1stdesign/support/download/password.zip Edit the path to your .htpasswd file. Chmod access.cgi to 755 .

4)Go to access.cgi and create your admin password.

5)Start adding users.

6)Smile :-)

- Updated: Saturday, March 02, 2002
   
»•« What is the path to my site? -

  The path to your site is

/home/sites/www.yourdomain.com/web

- Updated: Saturday, March 02, 2002
   
»•« What is the path to the date program? -

  The path to the date program on our server's is:

/bin/date

- Updated: Saturday, March 02, 2002
   
»•« How should I set my file permissions on a Perl script? -

  Often times, 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 now important. Finally, never set your file permissions to rwxrwxrwx, or chmod 777. This is not necessary, may cause a security problem on your website, and will cause your Perl script to not execute at all.

- Updated: Saturday, March 02, 2002
   
»•« How do I CHMOD my CGI and Perl files with CuteFTP? -

  1)Go to http://cuteftp.com/download/ and download CuteFTP.
2)FTP into your site.
3)Right click on the file you want to CHMOD.
4)Select 'CHMOD' from the menu.
5)CHMOD the file to the correct permission(755,711..etc)

- Updated: Saturday, March 02, 2002
   
»•« What program can I use to setup a mailing list for my users? -

  We use and suggest a free cgi script called powerlist. It can be downloaded from here http://www.1stdesign.net/support/download/powerlist.zip

If you need help setting powerlist up please email support@1stdesign.net.

- Updated: Saturday, March 02, 2002
   
»•« What is the location of sendmail? -

  The location of sendmail is

/usr/sbin/sendmail

- Updated: Saturday, March 02, 2002
   
»•« How do I setup crontabs? -

  Just send support@1stdesign.net an email with the following:

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

- Updated: Saturday, March 02, 2002
   
»•« What is the location of the Perl 5 libraries? -

  When using Perl 5 make sure that the first line of your Perl CGI has the following:

#!/usr/bin/perl

- Updated: Saturday, March 02, 2002
   
 
© Copyright 2000 - 2002 1st Design.net - All rights reserved