Debian Codegraph @

cgi/cgispex.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
5 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
7 <head>
8 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
9 <meta http-equiv="Content-Style-Type" content="text/css" />
10 <meta name="author" content="Mikio Hirabayashi" />
11 <meta name="keywords" content="QDBM, DBM, database, CGI" />
12 <meta name="description" content="specifications of CGI of QDBM" />
13 <link rel="contents" href="./" />
14 <link rel="alternate" href="cgispex-ja.html" hreflang="ja" title="the Japanese version" />
15 <link rev="made" href="mailto:[email protected]" />
16 <title>Specifications of CGI Scripts of QDBM</title>
17 <style type="text/css">html { margin: 0em 0em; padding: 0em 0em; background: #eeeeee none; }
18 body { margin: 2em 2em; padding: 0em 0em;
19 background: #eeeeee none; color: #111111;
20 font-style: normal; font-weight: normal; }
21 h1 { margin-top: 1.8em; margin-bottom: 1.3em; font-weight: bold; }
22 h2 { margin-top: 1.8em; margin-bottom: 1.1em; font-weight: bold;
23 border-left: solid 0.6em #445555; border-bottom: solid 1pt #bbbbbb;
24 padding: 0.5em 0.5em; width: 60%; }
25 h3 { margin-top: 1.8em; margin-bottom: 0.8em; font-weight: bold; }
26 hr { margin-top: 2.5em; margin-bottom: 1.5em; height: 1pt;
27 color: #999999; background-color: #999999; border: none; }
28 div.note,div.navi { text-align: right; }
29 div.logo { text-align: center; margin: 3em 0em; }
30 div.logo img { border: inset 2pt #ccccdd; }
31 p { margin: 0.8em 0em; line-height: 140%; }
32 p,dd { text-indent: 0.8em; }
33 div,pre { margin-left: 1.7em; margin-right: 1.7em; }
34 pre { background-color: #ddddee; padding: 0.2em; border: 1pt solid #bbbbcc; font-size: smaller; }
35 kbd { color: #111111; font-style: normal; font-weight: bold; }
36 a { color: #0022aa; text-decoration: none; }
37 a:hover,a:focus { color: #0033ee; text-decoration: underline; }
38 a.head { color: #111111; text-decoration: none; }
39 table { padding: 1pt 2pt 1pt 2pt; border: none; margin-left: 1.7em; border-collapse: collapse; }
40 th { padding: 1pt 4pt 1pt 4pt; border-style: none;
41 text-align: left; vertical-align: bottom; }
42 td { padding: 1pt 4pt 1pt 4pt; border: 1pt solid #333333;
43 text-align: left; vertical-align: top; }
44 ul,ol,dl { line-height: 140%; }
45 dt { margin-left: 1.2em; }
46 dd { margin-left: 2.0em; }
47 ul.lines { list-style-type: none; }
48 @media print {
49 html,body { margin: 0em 0em; background-color: #ffffff; color: #000000; }
50 h1 { padding: 8em 0em 0.5em 0em; text-align: center; }
51 h2 { page-break-before: always; }
52 div.note { text-align: center; }
53 div.navi,div.logo { display: none }
54 hr { display: none; }
55 pre { margin: 0.8em 0.8em; background-color: #ffffff;
56 border: 1pt solid #aaaaaa; font-size: smaller; }
57 a,kbd { color: #000000; text-decoration: none; }
58 h1,h2,h3 { font-family: sans-serif; }
59 p,div,li,dt,dd { font-family: serif; }
60 pre,kbd { font-family: monospace; }
61 dd { font-size: smaller; }
62 }
63 </style>
64 </head>
65
66 <body>
67
68 <h1>Specifications of CGI Scripts of QDBM</h1>
69
70 <div class="note">Copyright (C) 2000-2006 Mikio Hirabayashi</div>
71 <div class="note">Last Update: Thu, 26 Oct 2006 15:00:20 +0900</div>
72 <div class="navi">[<a href="cgispex-ja.html" hreflang="ja">Japanese</a>]</div>
73
74 <hr />
75
76 <h2>Table of Contents</h2>
77
78 <ol>
79 <li><a href="#overview">Overview</a></li>
80 <li><a href="#building">Building</a></li>
81 <li><a href="#qadm">CGI Script for Database Administration</a></li>
82 <li><a href="#qupl">CGI Script for File Upload</a></li>
83 <li><a href="#qfts">CGI Script for Full-text Search</a></li>
84 <li><a href="#webconf">Configuration of Web Servers</a></li>
85 </ol>
86
87 <hr />
88
89 <h2><a name="overview" id="overview" class="head">Overview</a></h2>
90
91 <p>Three CGI scripts are included in the package of QDBM, as utilities or sample applications. The first administers databases of Depot, Curia, and Villa. The second helps you to upload files, with utilities of Cabin. The third realizes a full-text search system with a database of Odeum.</p>
92
93 <hr />
94
95 <h2><a name="building" id="building" class="head">Building</a></h2>
96
97 <p>Change the current working directory to the sub directory named `cgi'.</p>
98
99 <pre>cd cgi
100 </pre>
101
102 <p>Run the configuration script.</p>
103
104 <pre>./configure
105 </pre>
106
107 <p>Build programs.</p>
108
109 <pre>make
110 </pre>
111
112 <p>Install programs. This operation must be carried out by the root user.</p>
113
114 <pre>make install
115 </pre>
116
117 <p>When a series of work finishes, the following files will be installed. As for the rest, documents will be installed under `/usr/local/share/qdbm/cgi'.</p>
118
119 <pre>/usr/local/libexec/qadm.cgi
120 /usr/local/libexec/qupl.cgi
121 /usr/local/libexec/qfts.cgi
122 /usr/local/share/qdbm/cgi/qadm.conf
123 /usr/local/share/qdbm/cgi/qupl.conf
124 /usr/local/share/qdbm/cgi/qfts.conf
125 </pre>
126
127 <p>Install CGI scripts and their configuration files to a public directory of WWW, according to each of the following sections.</p>
128
129 <hr />
130
131 <h2><a name="qadm" id="qadm" class="head">CGI Script for Database Administration</a></h2>
132
133 <p>`qadm.cgi' is a CGI script to administer database files of Depot, Curia, and Villa. Database files can be administered with it via WWW. Contents of the key and the value of each record should be character strings. The comparing function of the advanced API is lexical ordering. The available operations are listing databases, creating a database, removing a database, downloading a database, listing records, storing a record and deleting a record.</p>
134
135 <p>To install `qadm.cgi', perform the following steps. Copy `qdbm.cgi' and `qadm.conf' into a directory where CGI is available. And, create a directory `qadmdir' in the CGI directory. For example, if the CGI directory is `/home/mikio/public_html', the following steps are suggested.</p>
136
137 <pre>cd /home/mikio/public_html
138 cp /usr/local/libexec/qadm.cgi .
139 cp /usr/local/share/qdbm/cgi/qadm.conf .
140 mkdir qadmdir
141 </pre>
142
143 <p>The directory `qadmdir' should be granted the permission of reading, writing, and execution. Being most easily, the following steps are suggested. As for the rest, you can grant the CGI script setuid bit, or you can use a so-called suExec mechanism.</p>
144
145 <pre>cd /home/mikio/public_html
146 chmod 1777 qadmdir
147 </pre>
148
149 <p>`qadm.conf' is the configuration file. As the default contents are the following, you can modify them arbitrarily.</p>
150
151 <pre>encoding: UTF-8
152 lang: en
153 title: Administration CGI
154 datadir: qadmdir
155 keychop: true
156 valchop: false
157 </pre>
158
159 <p>`encoding' specifies the character encoding of the shown page and the records of database files. `lang' specifies the language of the shown page. `title' specifies the title of the shown page. `datadir' specifies the path of the directory containing database files. `keychop' and `valchop' specifies whether to normalize keys or values. If one is `true', white spaces at the end of each content are removed, and the contents can not contain linefeed codes.</p>
160
161 <p>Access the URL of `qadm.cgi' with a web browser. Then, follow the navigation of the page and administer the database.</p>
162
163 <p>For automatic agents to retrieve a stored record, the mechanism to get the as-is contents of the value of a records specified with a URL is provided. For example, if the URL of the CGI script is `http://a.b.c/qadm.cgi' and the name of the database is `staff' and the key is `mikio', the agent should access `http://a.b.c/qadm.cgi/staff/mikio'. That is, separated with '/', the URL of the CGI script entails the database name (without any suffix), which entails the key.</p>
164
165 <p>If you want to administer existing database files, you should place them in the directory `qadmdir'. And, the database files of the basic API should have the suffix `.dp'. The database directories of the extended API should have the suffix `.cr'. The database files of the advanced API should have the suffix `.vl'. For example, they are `foo.dp', `bar.cr' or `baz.vl'. Moreover, each database file or directory should be writable and readable by the CGI script.</p>
166
167 <hr />
168
169 <h2><a name="qupl" id="qupl" class="head">CGI Script for File Upload</a></h2>
170
171 <p>`qupl.cgi' is a CGI script to upload files, with Cabin. You can upload arbitrary files to your web server. You can perform downloading and deleting also.</p>
172
173 <p>To install `qupl.cgi', perform the following steps. Copy `qupl.cgi' and `qupl.conf' into a directory where CGI is available. And, create a directory `qupldir' in the CGI directory. For example, if the CGI directory is `/home/mikio/public_html', the following steps are suggested.</p>
174
175 <pre>cd /home/mikio/public_html
176 cp /usr/local/libexec/qupl.cgi .
177 cp /usr/local/share/qdbm/cgi/qupl.conf .
178 mkdir qupldir
179 </pre>
180
181 <p>The directory `qupldir' should be granted the permission of reading, writing, and execution. Being most easily, the following steps are suggested. As for the rest, you can grant the CGI script setuid bit, or you can use a so-called suExec mechanism.</p>
182
183 <pre>cd /home/mikio/public_html
184 chmod 1777 qupldir
185 </pre>
186
187 <p>`qupl.conf' is the configuration file. As the default contents are the following, you can modify them arbitrarily.</p>
188
189 <pre>encoding: UTF-8
190 lang: en
191 title: Administration CGI
192 datadir: qupldir
193 quota: 67108864
194 </pre>
195
196 <p>`encoding' specifies the character encoding of the shown page and the records of database files. `lang' specifies the language of the shown page. `title' specifies the title of the shown page. `datadir' specifies the path of the directory containing database files. `quota' specifies the limit of the total size of uploaded files.</p>
197
198 <p>Access the URL of `qupl.cgi' with a web browser. Then, follow the navigation of the page and administer the files.</p>
199
200 <hr />
201
202 <h2><a name="qfts" id="qfts" class="head">CGI Script for Full-text Search</a></h2>
203
204 <p>`qfts.cgi' is a CGI script to perform full-text search with a database of Odeum. It realizes full-text search system of a web site. Generating a database of the index is performed with the command `odidx'. Searching the index is performed with `qfts.cgi'. Search methods have two kinds: `AND search' retrieves documents which include all search words, `OR search' retrieves documents which include at least one of search words. Search results are ordered by scores.</p>
205
206 <p>To install `qfts.cgi', perform the following steps. Copy `qfts.cgi' and `qfts.conf' into a directory where CGI is available. And, create an index `casket' in the CGI directory. For example, if the CGI directory is `/home/mikio/public_html', the following steps are suggested.</p>
207
208 <pre>cd /home/mikio/public_html
209 cp /usr/local/libexec/qfts.cgi .
210 cp /usr/local/share/qdbm/cgi/qfts.conf .
211 odidx register casket
212 odidx relate casket
213 </pre>
214
215 <p>If directories of search targets are not under the directory including CGI scripts, you can make symbolic links to the target directories there.</p>
216
217 <p>When your site is updated, the index also shuld be updated with the following steps. These operations are suggested to be automated with `crontab' and so on.</p>
218
219 <pre>cd /home/mikio/public_html
220 odidx register casket
221 odidx purge casket
222 odidx relate casket
223 odmgr optimize casket
224 </pre>
225
226 <p>`qfts.conf' is the configuration file. As the default contents are the following, you can modify them arbitrarily.</p>
227
228 <pre>encoding: ISO-8859-1
229 lang: en
230 title: Full-text Search CGI
231 index: casket
232 prefix: ./
233 diridx: index.html
234 decuri: false
235 help: &lt;h1&gt;Full-text Search CGI&lt;/h1&gt;
236 help: &lt;p&gt;Input search words into the above form and push the [Search] button.&lt;/p&gt;
237 help: &lt;p&gt;This is a sample application of the inverted API of QDBM.&lt;/p&gt;
238 </pre>
239
240 <p>`encoding' specifies the character encoding of the shown page and the records of database files. `lang' specifies the language of the shown page. `title' specifies the title of the shown page. `index' specifies the path of the index. `prefix' specifies the prefix to be attached on the URI of each document. For example, if `prefix' is `http://x.y.z/foo/', `./bar/baz.html' and `bar/baz.html' are shown as `http://x.y.z/foo/bar/baz'. `diridx' specifies the name of a file standing for a directory. For example, if `diridx' is `index.html', `./foo/index.html' is shown as `./foo/'. `decuri' specifies that, if the value is `true', URIs of documents are expressed with decoded. `help' specifies the help message shown at the first page.</p>
241
242 <p>Access the URL of `qfts.cgi' with a web browser. Then, follow the navigation of the page and perform full-text search.</p>
243
244 <p>For more information about the command `odidx' to generate the index, refer to the fundamental specifications of QDBM. If your site is large-sized, to reduce size of the index, you should consider building QDBM with ZLIB enabled.</p>
245
246 <hr />
247
248 <h2><a name="webconf" id="webconf" class="head">Configuration of Web Servers</a></h2>
249
250 <p>To use CGI scripts, configuration of your web server should permit CGI execution. If CGI scripts are deployed with usual contents, configuration of Apache is like the following.</p>
251
252 <pre>Options ExecCGI
253 AddHandler cgi-script .cgi
254 </pre>
255
256 <p>Altanatively, if you set up an exclusive directory for CGI scripts, configuration of Apache is like the following.</p>
257
258 <pre>ScriptAlias /~mikio/cgi-bin/ "/home/mikio/public_html/cgi-bin"
259 </pre>
260
261 <p>If the library path of your web server does not contain `/usr/local/lib', you may have to define it explicitly. Configuration of Apache is like the following.</p>
262
263 <pre>SetEnv LD_LIBRARY_PATH "/lib:/usr/lib:/usr/local/lib"
264 </pre>
265
266 <p>On Microsoft IIS, the directory including a CGI script and the current directory on runtime are defferent. Since the latter is the root of a virtual directory, each configuration file should be deployed there.</p>
267
268 <hr />
269
270 </body>
271
272 </html>
273
274 <!-- END OF FILE -->