Skip to Main Content
KDDI
Site Map

For Business
Network Services Mobile Services Overseas Subsidiaries & Offices Inquiries
Network Services
Global Services
Domestic Services
Telephone Services

Intranet Services

Data Center  Services

Security Services
KDDI Hosting Service
Overview and Features Service Option Charges
How to Use Domain Search Related Links
Frequently Asked Questions

Main Contents

Using Original CGI and SSI


Languages that can be used

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.

First line of script

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.

File names

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

Example


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

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

Directory

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

Permission

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.

Executable scripts


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

Unexecutable scripts


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

Path in the system

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.

How to specify "file.dat" from "list.cgi"


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"

When using a path in the system


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".

When using a URL


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

UNIX command path

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

Conditions for Operating SSI


Extension for SSI files

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.

Example


test.shtml
OK
test.htm
Bad
test.html
Bad

Executable files

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.

"#exec cmd"

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.

Executable files


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

Unexecutable files


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

"#exec 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.

Executable files


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

Unexecutable files


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

Directory restriction in "#include file"

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).

Files that can be specified


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

Files that cannot be specified


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

"#include virtual"

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

Example


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

"#fsize" and "#flastmod"

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".
Return to Top
Inquiry
au - Mobile Communication Telephone au one net For Business
Corporate Information News Release Investor Relations
KDDI CORPORATION Disclaimer About Links System Requirements Privacy Policy Copyright © KDDI CORPORATION. All Rights Reserved.