1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549
|
<?xml version="1.0" encoding="EUC-JP"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"><head><!--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->
<title>Apache Tutorial: CGI ˤưŪƥ - Apache HTTP </title>
<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
<link href="../images/favicon.ico" rel="shortcut icon" /></head>
<body id="manual-page"><div id="page-header">
<p class="menu"><a href="../mod/">⥸塼</a> | <a href="../mod/directives.html">ǥ쥯ƥ</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Ѹ</a> | <a href="../sitemap.html">ȥޥå</a></p>
<p class="apache">Apache HTTP С 2.2</p>
<img alt="" src="../images/feather.gif" /></div>
<div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
<div id="path">
<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP </a> > <a href="http://httpd.apache.org/docs/">ɥơ</a> > <a href="../">С 2.2</a> > <a href="./">How-To / 塼ȥꥢ</a></div><div id="page-content"><div id="preamble"><h1>Apache Tutorial: CGI ˤưŪƥ</h1>
<div class="toplang">
<p><span>Available Languages: </span><a href="../en/howto/cgi.html" hreflang="en" rel="alternate" title="English"> en </a> |
<a href="../ja/howto/cgi.html" title="Japanese"> ja </a> |
<a href="../ko/howto/cgi.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
</div>
<div class="outofdate">This translation may be out of date. Check the
English version for recent changes.</div>
</div>
<div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#intro">Ϥ</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#configuring">CGI Ĥ褦 Apache ꤹ</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#writing">CGI ץ</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#troubleshoot">ޤưʤ !</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#behindscenes">DzäƤΤ?</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#libraries">CGI ⥸塼/饤֥</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#moreinfo">ʤ</a></li>
</ul></div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="intro" id="intro">Ϥ</a></h2>
<table class="related"><tr><th>Ϣ⥸塼</th><th>Ϣǥ쥯ƥ</th></tr><tr><td><ul><li><code class="module"><a href="../mod/mod_alias.html">mod_alias</a></code></li><li><code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code></li></ul></td><td><ul><li><code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code></li><li><code class="directive"><a href="../mod/core.html#options">Options</a></code></li><li><code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code></li></ul></td></tr></table>
<p>CGI (Common Gateway Interface) ϡ֥Ф
ƥ볰ץȶĴư뤿ˡ
ƤޤΥץϤФ CGI ץ
CGI ץȤȸƤФޤCGI ϡ֥ȤưŪ
ƥĤ֤κǤñǰŪˡǤΥɥȤϡ
Apache ֥Ф CGI ꤷ
CGI ץϤ뤿ȤʤǤ礦</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="configuring" id="configuring">CGI Ĥ褦 Apache ꤹ</a></h2>
<p>CGI ץưˤϡCGI Ĥ褦
Apache Ԥɬפޤ
ԤʤˡĤޤ</p>
<h3><a name="scriptalias" id="scriptalias">ScriptAlias</a></h3>
<p><code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>
ǥ쥯ƥ֤Ѥơ
CGI ץѤ̤̥ǥ쥯ȥ Apache ꤷޤ
Apache ϡΥǥ쥯ȥƤΥե CGI
ץǤȲꤷޤ
ơ̤ʥ饤Ȥᤵȡ
Υץμ¹Ԥߤޤ</p>
<p><code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>
ǥ쥯ƥ֤ϰʲΤ褦˻Ѥޤ:</p>
<div class="example"><p><code>
ScriptAlias /cgi-bin/ /usr/local/apache2/cgi-bin/
</code></p></div>
<p>ǥեȰ֤ Apache ȡ뤷ʤС
ϥǥեȾ֤ <code>httpd.conf</code>
ե˴ޤޤƤޤ
<code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>
ǥ쥯ƥ֤ϡURL ղäǥ쥯ȥ
<code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code>
ǥ쥯ƥ֤ȤʤƤޤ
<code class="directive">Alias</code> <code class="directive">ScriptAlias</code>
̾<code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>
ǥ쥯ȥ곰Υǥ쥯ȥΤ˻Ѥޤ
<code class="directive">Alias</code> <code class="directive">ScriptAlias</code>
Ȥκϡ<code class="directive">ScriptAlias</code> ƬǻϤޤ뤹٤Ƥ
URL CGI ץȤߤʤȤɲäΰ̣ޤǤ뤳ȤǤ
äơ嵭Ǥϡ<code>/cgi-bin/</code>
ǻϤޤؤΤꥯȤФơǥ쥯ȥ
<code>/usr/local/apache2/cgi-bin/</code>
CGI ץȤư褦 Apache ˼ޤ</p>
<p>㤨СURL <code>http://www.example.com/cgi-bin/test.pl</code>
ᤵ줿硢Apache ե
<code>/usr/local/apache2/cgi-bin/test.pl</code>
¹ԤνϤ֤Ȥߤޤ
ե뤬¸ߤ¹ԲǽǤꡢ줿ˡǽϤ֤ޤ
ǤʤСApache ϥ顼å֤ޤ</p>
<h3><a name="nonscriptalias" id="nonscriptalias">ScriptAlias ǥ쥯ȥ곰 CGI</a></h3>
<p>CGI ץϡƥͳ
<code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>
줿ǥ쥯ȥ¤뤳ȤФФޤˡˤꡢ
CGI ץѤǤ桼Ԥ椹뤳ȤǤޤ
ʤ顢ŬڤʥƥкȤʤСCGI
ץǤդΥǥ쥯ȥǼ¹ԤǤʤ褦ˤͳϤޤ
㤨С桼 <code class="directive"><a href="../mod/mod_userdir.html#userdir">UserDir</a></code>
ǥ쥯ƥ֤Υۡǥ쥯ȥ۲˥֥ƥĤȤޤ
⤷餬 CGI ץĤȤ˾ǤƤ⡢ᥤ
<code>cgi-bin</code> ǥ쥯ȥؤΥǤʤ硢
CGI ץ¹Ԥ뤳ȤǤ¾ξ꤬ɬפˤʤޤ</p>
<p>ǤդΥǥ쥯ȥ CGI μ¹ԤĤˤʳ꤬ɬפǤ
ޤ<code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code> <code class="directive"><a href="../mod/core.html#sethandler">SetHandler</a></code> ǥ쥯ƥ֤ˤä
<code>cgi-script</code> ϥɥ餬ǽˤʤäƤɬפޤ
ˡ<code class="directive"><a href="../mod/core.html#options">Options</a></code> ǥ쥯ƥ֤
<code>ExecCGI</code> ꤵƤʤФʤޤ</p>
<h3><a name="options" id="options">CGI μ¹Ԥǽˤ뤿 Options Ū˻Ѥ</a></h3>
<p>ФΥᥤե <code class="directive"><a href="../mod/core.html#options">Options</a></code>
ǥ쥯ƥ֤Ū˻Ѥ뤳ȤǡΥǥ쥯ȥ۲
CGI μ¹ԤĤ褦˻ꤹ뤳ȤǤޤ:</p>
<div class="example"><p><code>
<Directory /usr/local/apache2/htdocs/somedir><br />
<span class="indent">
Options +ExecCGI<br />
</span>
</Directory>
</code></p></div>
<p>嵭ǥ쥯ƥ֤ϡCGI եμ¹Ԥǽˤ褦
Apache ޤޤɤΥե뤬 CGI ե뤫
Фɬפޤ
<code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code>
ǥ쥯ƥ֤Ǥϡ<code>cgi</code> ޤ <code>pl</code>
ĥҤ˻Ĥ٤ƤΥե CGI
ץȤƤߤʤȤФޤ:</p>
<div class="example"><p><code>
AddHandler cgi-script .cgi .pl
</code></p></div>
<h3><a name="htaccess" id="htaccess">.htaccess ե</a></h3>
<p><a href="htaccess.html"><code>.htaccess</code> 塼ȥꥢ</a>
<code>httpd.conf</code> ѹǤʤˤɤä CGI ץ
Ȥ褦ˤ뤫Ƥޤ</p>
<h3><a name="userdir" id="userdir">User ǥ쥯ȥ</a></h3>
<p><code>.cgi</code> ǽ뤹٤ƤΥեФ CGI ץ
¹ԤĤˤϡʲѤǤޤ</p>
<div class="example"><p><code>
<Directory /home/*/public_html><br />
<span class="indent">
Options +ExecCGI<br />
AddHandler cgi-script .cgi<br />
</span>
</Directory>
</code></p></div>
<p>桼ǥ쥯ȥ <code>cgi-bin</code> ֥ǥ쥯ȥ
٤ƤΥե CGI ץȤƻꤷˤ
ʲΤ褦ʤΤȤޤ</p>
<div class="example"><p><code>
<Directory /home/*/public_html/cgi-bin><br />
<span class="indent">
Options ExecCGI<br />
SetHandler cgi-script<br />
</span>
</Directory>
</code></p></div>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="writing" id="writing">CGI ץ</a></h2>
<p>̾Ρץץߥ CGI
ץߥδ֤ˤϼĤΰ㤤ޤ</p>
<p>ĤϡCGI ץΤ٤ƤνϤˤ MIME-type
إåդʤФʤޤ
ϤɤΤ褦ʼΥƥĤäƤ뤫饤Ȥ˼
HTTP إåǤۤȤɤξǤϡΤ褦˽Ϥޤ:</p>
<div class="example"><p><code>
Content-type: text/html
</code></p></div>
<p>⤦ĤϡϤ HTML
֥饦ɽ뤳ȤǤ벿¾ηˤɬפޤ
ξ HTML Ǥ礦GIF ¾ HTML
ƥĤϤ CGI ץȤ⤢Ǥ礦</p>
<p>ʳǤϡCGI ץȤϡ
ʤƤ¾ΥץȤ褯ƤǤ礦</p>
<h3><a name="firstcgi" id="firstcgi">ǽ CGI ץ</a></h3>
<p>˼Τϡ֥饦 1 CGI
ץǤʲϤ<code>first.pl</code>
Ȥե¸ <code>cgi-bin</code>
ǥ쥯ȥ֤Ƥ</p>
<div class="example"><p><code>
#!/usr/bin/perl<br />
print "Content-type: text/html\n\n";<br />
print "Hello, World.";
</code></p></div>
<p>Perl ̤ƤʤƤ⡢
뤫뤳ȤϤǤǤ礦1 ܤϡ
<code>/usr/bin/perl</code> ǸĤ륤ץ
Υե뤹뤳ȤǤΥץब¹Ԥ뤳Ȥ
Apache (Ǽ¹Ԥ褦ȤƤʤСΥ )
ޤ2 ܤϡҤȤ content-type ޤ
ˤԤĤȤղäޤ
ˤꡢإåν˶Ԥ֤졢HTTP
إåνȥܥǥλϤޤޤ3 ܤϡ"Hello, World."
ȤʸǽȤʤޤ</p>
<p>ߤΥ֥饦ɥ쥹</p>
<div class="example"><p><code>
http://www.example.com/cgi-bin/first.pl
</code></p></div>
<p>뤤ϥե֤ꤹȡ
<code>Hello, World.</code>
Ȥ 1 Ԥ֥饦ɤ˸Ǥ礦
ϤޤꥨƥʤȤǤϤޤ
줬ޤưС
¾ΤɤΤ褦ʤΤǤưȤǤ褦ˤʤޤ</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="troubleshoot" id="troubleshoot">ޤưʤ !</a></h2>
<p>֤ CGI ץؤΥԤʤäȤ
֥饦ǸǽͤĤδŪʤȤޤ:</p>
<dl>
<dt>CGI ץν</dt>
<dd>餷 ! Ϥ٤ƤޤưȤ̣ޤ
Ϥɤ⡢֥饦˽Ƥʤϡ
<code>Content-Type</code> CGI ץ
åȤǧƤ</dd>
<dt>CGI ץΥɡޤ "POST Method Not Allowed"
Ȥå</dt>
<dd>ϡCGI ץǤ褦 Apache
ŬڤꤷƤʤäȤ̣ޤ<a href="#configuring">CGI Ĥ褦
Apache ꤹ</a>ξϤɤľ
ʤְ㤨õƤߤƤ
</dd>
<dt>å "Forbidden" ǻϤޤäƤ</dt>
<dd>ϥѡߥåȤȤ̣ޤ
<a href="#errorlogs">Apache Υ顼</a>ȡҤ<a href="#permissions">֥եΥѡߥå</a>
ξϤåƤ
</dd>
<dt>"Internal Server Error" Ȥå</dt>
<dd><a href="#errorlogs">Apache
Υ顼</a>åȡ"Premature end of script headers"
ȤϿƤȻפޤơ餯 CGI
ץˤä줿顼åϿƤǤ礦
ξ硢CGI ץबŬڤ
HTTP إåϤǤʤΤ뤿ˡ
ʲγƾϤǥåƤߤƤ</dd>
</dl>
<h3><a name="permissions" id="permissions">եΥѡߥå</a></h3>
<p>ФϤʤθ¤Ǽ¹ԤƤʤΤ˺ʤ褦ˡ
ĤޤꡢưȤФø⤿ʤ桼 - ̾ <code>nobody</code>
<code>www</code> θ¤Ǽ¹Ԥޤäơʤͭ
ե¹Ԥˤ̤ΥѡߥåɬפȤʤޤ
̾<code>nobody</code> ¹ԤΤ˽ʬʥѡߥåͿˡϡ
եïǤ¹ԲǽȤѡߥåͿ뤳ȤǤ:</p>
<div class="example"><p><code>
chmod a+x first.pl
</code></p></div>
<p>ޤ⤷ʤΥץब¾Υեɤ߽ʤС
Υեϡ줬ǽȤʤѡߥå
äƤɬפޤ</p>
<h3><a name="pathinformation" id="pathinformation">ѥȴĶ</a></h3>
<p>ޥɥ饤ץ¹ԤȤ
ռʤƤ⥷Ϥޤ
㤨СȤեΤˤɤ褤
<code>PATH</code> ޤ</p>
<p>ץब CGI ץȤƥ֥ФˤäƼ¹ԤȤ
Ʊ <code>PATH</code> ǤϤʤ⤷ޤ
CGI ץǸƤӽФץ
(㤨С<code>sendmail</code> Τ褦ʤ) ϡ
եѥǻꤹɬפǤ礦ˤꡢCGI
ץ¹Ԥ褦ȤȤ
ϤΤ褦ʥץĤ뤳ȤǤޤ</p>
<p>ƱͤʤȤϡץȤΥץ (Ф <code>perl</code>)
ؤΥѥǡCGI ץ 1 ܤ˼Τ褦˼ޤ:</p>
<div class="example"><p><code>
#!/usr/bin/perl
</code></p></div>
<p>줬ץؤμºݤΥѥǤ뤳ȤǧƤޤ</p>
<p>ޤCGI ץब¾<a href="#env">Ķѿ</a>˰¸ƤϡδĶѿ
Apache Ϥ褦ˤɬפޤ</p>
<h3><a name="syntaxerrors" id="syntaxerrors">ץ२顼</a></h3>
<p>CGI
ץबԤΤץ༫Ȥ꤬Ǥ
CGI λȤҤĤθȤƤʤʤС
ޤְ㤤ʤǤ礦֥饦ȤäƥƥȤ
ޤǧ뤳Ȥϡޥɥ饤ץब¹ԤǤ뤳ȤǤ
㤨Сʲ¹ԤƤߤƤ:</p>
<div class="example"><p><code>
cd /usr/local/apache2/cgi-bin<br />
./first.pl
</code></p></div>
<p>(<code>perl</code> ץϸƤФʤǤ
Apache ץȤκǽιԤ <a href="#pathinformation">ѥ</a> ȤäƸĤޤ)</p>
<p>ǽ˥ץफϤΤ <code>Content-Type</code> ޤߡ
˶Ԥ³ HTTP إåǤʤФʤޤ¾ΤΤϤƤ
ϡApache ϤΥץзͳǼ¹Ԥ褦ȤȤˤ
<code>Premature end of script headers</code> 顼Ϥޤܺ٤
嵭 <a href="#writing">CGI ץ</a> ɤǤ</p>
<h3><a name="errorlogs" id="errorlogs">顼</a></h3>
<p>顼ͧãǤ
ƤΤޤʤȤϡ顼˥åޤ
ɬǽ˸٤Ǥ
⤷ʤ֥ȤŤƤ꤬
顼λȤƤʤʤСä¾ΥȤǼŤ٤Ǥ
顼ɤؤ֤ȤǡۤȤƤ꤬®˳ǧ졢
®˲褵ȤȤʬǤ礦</p>
<h3><a name="suexec" id="suexec">Suexec</a></h3>
<p><a href="../suexec.html">suexec</a> ݡȥץ
СۥȤ桼Υۡǥ쥯ȥξ˰ͤä
CGI ץ㤦桼¤β餻뤳Ȥǽˤޤ
Suexec θ¤Υå˸ʤ
CGI ץब <code>Premature end of script headers</code> 顼
¹Ԥޤ</p>
<p>suexec ȤäƤ뤫ɤĴ٤ˤ <code>apachectl
-V</code> ¹Ԥơ<code>SUEXEC_BIN</code> ξĴ٤Ƥ
Apache <code class="program"><a href="../programs/suexec.html">suexec</a></code> ΥХʥȯϡsuexec
Ѥޤ</p>
<p>suexec Ƥʤ¤ꡢȤ٤ǤϤޤ
suexec ̵ˤˤϡ<code>SUEXEC_BIN</code> ؤƤ
<code class="program"><a href="../programs/suexec.html">suexec</a></code> Хʥ (̾ѹ) Ǥ
<a href="../suexec.html">suexec</a> ɤǡޤ
ȤΤǤС<code>suexec -V</code> ¹Ԥ suexec
եΰ֤Ĵ١ΥեȤäƥݥꥷȿ
ĤƤ</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="behindscenes" id="behindscenes">DzäƤΤ?</a></h2>
<p>CGI ץߥ˽Ϥȡ
ǵäƤ뤳ȤˤĤƹ뤳ȤΩޤ
֥饦ȥФɤΤ褦̿뤫ˤĤƤäˤǤ
ʤʤ顢"Hello, World."
ץȤϤ˷빽Ǥ
äͭפǤϤޤ</p>
<h3><a name="env" id="env">Ķѿ</a></h3>
<p>Ķѿϡ
ʤԥ塼ȤȤդ¸ߤƤͤǤ
ϡѥ
(ޥɤפȤ˼¹ԤºݤΥեõФȤ)
桼̾üʤɤΤ褦ʤΤǤ
̾ʻѤƤĶѿδʥꥹȤĴ٤ˤϡ
ޥɥץץȤ <code>env</code> Ϥޤ</p>
<p>CGI ν桢Фȥ֥饦Ķѿꤷ
ˤߤ̿뤳ȤǤ褦ˤʤޤ
δĶѿϡ֥饦 (Netscape, IE, Lynx)Х
(Apache, IIS, WebSite)¹ԤƤ CGI
ץ̾ʤɤǤ</p>
<p>ѿ CGI ץޤѤǤޤ
ơϥ饤ȤȥФ̿äȾʬǤ
ɬפѿδʥꥹȤ <a href="http://hoohoo.ncsa.uiuc.edu/cgi/env.html">http://hoohoo.ncsa.uiuc.edu/cgi/env.html</a> ˤޤ</p>
<p>ʲñ Perl CGI
ץϡϤƤδĶѿɽޤƱͤΥץϡ
Apache ǥȥӥ塼 <code>cgi-bin</code>
ǥ쥯ȥĴޤޤƤޤ
ĤѿɬܤǤꡢĤǤդǤ뤳ȤդƤ
ơΥꥹȤˤϤʤĤѿɽƤ뤫⤷ޤ
ˡApache ϥǥեȤѰդƤŪʤΤ
<a href="../env.html">ʤȤδĶѿä</a>Ρ
¿ΰۤʤˡѰդƤޤ</p>
<div class="example"><p><code>
#!/usr/bin/perl<br />
print "Content-type: text/html\n\n";<br />
foreach $key (keys %ENV) {<br />
<span class="indent">
print "$key --> $ENV{$key}<br>";<br />
</span>
}
</code></p></div>
<h3><a name="stdin" id="stdin">STDIN STDOUT</a></h3>
<p>Фȥ饤ȴ֤Τ⤦Ĥ̿ϡɸ
(<code>STDIN</code>)ɸ (<code>STDOUT</code>)
̤ƹԤʤޤ̾ʸ̮ˤơ<code>STDIN</code>
ϥܡɤץबư뤿Ϳե̣
<code>STDOUT</code> ̾拾ޤϥ̣ޤ</p>
<p>֥եफ CGI ץ<code>POST</code>
ȤեΥǡ̤ʥեޥåȤ«ͤ졢
<code>STDIN</code> ̤ơCGI ץ˰Ϥޤ
ץϥǡܡ
⤷ϥե뤫ƤΤ褦˽뤳ȤǤޤ</p>
<p>̤ʥեޥåȡפϤȤƤñǤե̾ͤϥ
(=) ǷФޤͤȤϥѥ (&) ǷФޤ
ڡѥɡΤ褦ݤʸϡ
餬ưܤˤʤ褦ˤʸ 16 ʤѴޤ
ǡʸϡʲΤ褦ˤʤޤ:
</p>
<div class="example"><p><code>
name=Rich%20Bowen&city=Lexington&state=KY&sidekick=Squirrel%20Monkey
</code></p></div>
<p>Τ褦ʸ URL
ղäΤǤ礦ξ硢Ф
<code>QUERY_STRING</code> ȤĶѿˤʸޤ
<code>GET</code> ꥯȤȸƤФޤ
HTML եǤϡǡϤ <code>GET</code>
<code>POST</code> ΤɤѤ뤫<code>FORM</code>
<code>METHOD</code> °ǻꤷޤ</p>
<p>CGI ץϡʸΩľʬ䤹Ǥޤ
ˤ⡢Υǡ饤֥⥸塼뤬¸ߤޤ
ϡCGI ץ¾̤ǤƱͤΩޤ</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="libraries" id="libraries">CGI ⥸塼/饤֥</a></h2>
<p>CGI ץȤݤʻŻʬƤ
ɥ饤֥ޤϥ⥸塼ȤȤƤ٤Ǥ
ϥ顼餷ᤤȯˤĤʤޤ</p>
<p>Perl CGI ץƤʤ顢⥸塼 <a href="http://www.cpan.org/">CPAN</a> Ƥޤ
ŪΤκǤڤƤ⥸塼 <code>CGI.pm</code> Ǥ
<code>CGI::Lite</code> ⸡Ƥޤ礦ϡۤȤɤΥץ
ˤɬפȤ뤹٤ƤεǽκǾåȤμǤ</p>
<p>C CGI ץƤʤ顢
ץޤΰĤ <a href="http://www.boutell.com/cgic/">http://www.boutell.com/cgic/</a>
Ƥ <code>CGIC</code> 饤֥Ǥ</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="moreinfo" id="moreinfo">ʤ</a></h2>
<p>CGI ˴ؤϥ֤ǿ¿ƤޤCGI
ˤĤƤ Usenet <a href="news:comp.infosystems.www.authoring.cgi">comp.infosystems.www.authoring.cgi</a> ǡ
¾Υ桼Ĥ뤳ȤǤޤHTML Writers Guide
-servers ꥹȤϡʤμ˲ƤʥǤ
<a href="http://www.hwg.org/lists/hwg-servers/">http://www.hwg.org/lists/hwg-servers/</a>
ǹ¿õФȤǤޤ</p>
<p>Ƥ餯 CGI
ץư˴ؤܺ٤ƤҤƤ
CGI λͤɤ٤ǤꥸʥС
<a href="http://hoohoo.ncsa.uiuc.edu/cgi/interface.html">NCSA</a>
ǡåץǡȤ줿ɥեȤ
<a href="http://web.golux.com/coar/cgi/">Common Gateway Interface RFC
ץ</a>ǻȤ뤳ȤǤޤ</p>
<p>CGI ˤĤơääƤꥹȤޤϥ˥塼
롼פ˼ȤäΡäƤۤȡ
ºݤ˵äȤɤ㤦ѤƤ륵С
CGI ץҤƤ˴ؤ뽽ʬʾȡ
ǽǤΥɤ褦ˤƤ
뤳Ȥǡ꤬ñ˸Ĥ褦ˤʤޤ</p>
<p>Apache ΥɤˤȯȤοƤʤ¤ꡢ
CGI ˴ؤ Apache
Хǡ١<strong>٤Ǥʤ</strong>
ȤܤƤ</p>
</div></div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="../en/howto/cgi.html" hreflang="en" rel="alternate" title="English"> en </a> |
<a href="../ja/howto/cgi.html" title="Japanese"> ja </a> |
<a href="../ko/howto/cgi.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
</div><div id="footer">
<p class="apache">Copyright 2006 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<p class="menu"><a href="../mod/">⥸塼</a> | <a href="../mod/directives.html">ǥ쥯ƥ</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Ѹ</a> | <a href="../sitemap.html">ȥޥå</a></p></div>
</body></html>
|