 |
|
|
|
 |
|  | |


The languages that can be used as CGI are as follows.

Language name (script name) |
Path |
Perl (Ver. 5.00503) |
/usr/bin/perl |
Bourne Shell |
/bin/sh |
C Shell |
/bin/csh |
|

Please note that programs using languages other than the ones listed above (C language, etc.)are not usable.

When using a script that works as a CGI, make sure to insert "#!" (processing path) in the first line. For example, when scripting in Perl, the first line of the script should look like the example below.

 |
#! /usr/bin/perl
|

| * |
Please note that the script does not work if the first line is skipped or there is an unnecessary tab or space in the first line. |

We do not specify a particular extension for the file names of CGI script. Therefore, any of the file names listed below is usable.

 |


 |
test.cgi |
 |
test.pl |
 |
test |
 |
sample.test.pl |

| * |
Double-byte (two-byte) characters and single-byte katakana cannot be used for file names. |
|

CGI script should be transferred to the directory under "/cgi-bin". Script under other directories (e.g.: "/htdocs") does not work as CGI.

We set permission (authorization for reading, writing, and executing) for CGI script at 700. If the permission is wrong, CGI is not executed. To use the "CGI syntax check" page on the Support Web, it is necessary to set permission at 704. When a sub-directory is created under "/cgi-bin", the permission must be 705 to execute the script under the sub-directory.

 |


-rwx------ mail.cgi (Permission 700)
-rwx---r-- mail.cgi (Permission 704)
drwx---r-x scripts (CGI under this directory can be excecuted)
|

 |


-rw-r--r-- counter.cgi (Permission 644)
drwx------ sub_dir (CGI under this directory cannot be executed)
|

The absolute path (we call it the absolute path in the system) that is used when designating files in Perl script or SSI and the paths in URL and FTP appear differently.

In FTP, an absolute path in a home directory is as follows.

 |
/home/fsXX/administrative user name/

| * |
XX: 10 or 20 (varies depending on the time of registration) |
|

For example, when an administrative user's ID is registered in "fs10" as "haxxxNNNNN", the absolute path in the system's home directory is as follows.

 |
/home/fs10/administrative user ID
|

Since this absolute path is set in HOME environmental variables, set the absolute paths for "htdocs" and "cgi-bin" under the home directory by using Perl script.

 |
$htdocs = $ENV{'HOME'} . "/htdocs/";
$cgi_bin = $ENV{'HOME'} . "/cgi-bin/";
|

| * |
Instead of absolute paths, it is possible to create relative paths based on the current directory. |

 |


When "list.cgi" is uploaded to "cgi-bin" and its data exists in "cgi-bin/data/file.dat", you have to specify "file.dat" from "list.cgi" using the absolute path shown below.

 |
/data/file.dat |

In addition, the relative path to specify "cgi-bin" from "htdocs" is as follows.

 |
../cgi-bin/
|

When you want to use "cgi-bin/date.pl" with "cmd" in "htdocs/ssi/sample.shtml", specify so as shown below.

 |
#exec cmd="../../cgi-bin/date.pl" |
|

 |


 |
Specify a file or direcotry in Perl script. |
 |
Specify a file using "#exec cmd" or "# - file" in SSI. |
 |
Specify a file using AuthUserFile in ".htaccess". |
|

 |


 |
Specify CGI using HTML. |
 |
Specify a URL in Perl script. |
 |
Specify a file using "#exec cgi" or "# - virtual" in SSI. |
|

You can invoke a UNIX command from Perl and Shell scripts. The most common command paths are listed below.

Command name |
Path |
Perl |
/usr/bin/perl |
nkf |
/usr/bin/nkf |
sendmail |
/usr/lib/sendmail |
date |
/usr/bin/date |
uuencode |
/usr/bin/uuencode |
cat |
/usr/bin/cat |
cut |
/usr/bin/cut |
|


The extension for HTML file names using SSI script is always ".shtml" (it is not possible to change a SSI extention to ".html" in ".htaccess" in DION Hosting Service). When other types of extension are used, SSI script becomes invalid.

 |


test.shtml |
|
test.htm |
|
test.html |
|
|
|

In "#exec cmd", by specifying an executable file, it is possible to include the executable file's execution results. Like CGI, files that can be specified as executable files are the following scripts only.

Language name (script name) |
Processing path |
Perl (Ver. 5.00503) |
/usr/bin/perl |
Bourne Shell |
/bin/sh |
C Shell |
/bin/csh |
|

Please note that programs that are written in scripts other than the ones listed above (C language, etc.) are not usable. The conditions for the script's first line and file name are the same as the ones for CGI.

It is necessary to write files specified by "cmd" using a relative or absolute path in the system. In DION Hosting Service, scripts that can be specified in "#exec cmd" are only the files under the "cgi-bin" directory. It is not possible to give authority for execution (file permission) to files in other locations.

 |


<!--#exec cmd="../cgi-bin/test-cmd.pl"-->
<!--#exec cmd="/home/fs10/haxxxNNNNN/cgi-bin/test-cmd.pl"-->
<!--#exec cmd="/usr/bin/date"-->
|

 |


<!--#exec cgi="test.pl"-->
<!--#exec cgi="../cgi-bin/test.cgi"-->
|

In "#exec cgi", CGI can be specified using a URL. When specifying in scripts that do not return execution results as CGI or when using a path instead of a URL, SSI cannot run.

 |


<!--#exec cgi="/cgi-bin/test-cgi.cgi-->
<!--#exec cgi="/cgi-bin/test/test-cgi.cgi-->
|

 |


<!--#exec cgi="test.pl"-->
<!--#exec cgi="../cgi-bin/test.cgi"-->
|

By specifying a file using "#include file", it is possible to include the file as it is. In DION Hosting Service, "#include file" allows you to specify, based on the current directory, a file in the same directory or under such directory. However, it cannot be specified with an absolute path (full path).

 |


<!--#include file="./test.txt"-->
|

 |


<!--#include file="../test.txt"-->
<!--#include file="../cgi-bin/test.txt"-->
<!--#include file="/export/home-c1/jkzki6/htdocs/test.txt-->
|

"#include virtual" is the same as "#include file", except for the fact that the files are specified using a URL.

 |


<!--#include virtual="./test.txt"-->
<!--#include virtual="../test.txt"-->
<!--#include virtual="/test/test.txt"-->
|

You can include the size of a specified file using "#fsize" and the time stamp of the specified file using "#flastmod". As for how to specify a file, you can specify "#fsize file=" and "#flastmod file=" using a direct path and "#fsize virtual=" and "#flastmod virtual=" using a URL. This is the same as "#include file" and "#include virtual".
|
|

|
|
|