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
|
<?xml version="1.0" encoding="EUC-KR"?>
<!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="ko" xml:lang="ko"><head><!--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->
<title>¾ÆÆÄÄ¡ ÅõÅ丮¾ó: CGI¸¦ »ç¿ëÇÑ µ¿Àû ÆäÀÌÁö »ý¼º - Apache HTTP Server</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 rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
<script src="../style/scripts/prettify.min.js" type="text/javascript">
</script>
<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="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">¿ë¾î</a> | <a href="../sitemap.html">»çÀÌÆ®¸Ê</a></p>
<p class="apache">Apache HTTP Server Version 2.4</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 Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.4</a> > <a href="./">How-To / Tutorials</a></div><div id="page-content"><div id="preamble"><h1>¾ÆÆÄÄ¡ ÅõÅ丮¾ó: CGI¸¦ »ç¿ëÇÑ µ¿Àû ÆäÀÌÁö »ý¼º</h1>
<div class="toplang">
<p><span>°¡´ÉÇÑ ¾ð¾î: </span><a href="../en/howto/cgi.html" hreflang="en" rel="alternate" title="English"> en </a> |
<a href="../fr/howto/cgi.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
<a href="../ja/howto/cgi.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
<a href="../ko/howto/cgi.html" title="Korean"> ko </a></p>
</div>
<div class="outofdate">ÀÌ ¹®¼´Â ÃÖ½ÅÆÇ ¹ø¿ªÀÌ ¾Æ´Õ´Ï´Ù.
ÃÖ±Ù¿¡ º¯°æµÈ ³»¿ëÀº ¿µ¾î ¹®¼¸¦ Âü°íÇϼ¼¿ä.</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¸¦ Çã¿ëÇϵµ·Ï ¾ÆÆÄÄ¡ ¼³Á¤Çϱâ</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">µÚ¿¡¼´Â ¹«½¼ ÀÏÀÌ ¹ú¾îÁö´Â°¡?</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><ul class="seealso"><li><a href="#comments_section">Comments</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¸¦ ±¸¼ºÇÏ´Â ¹æ¹ýÀ» ¼Ò°³ÇÏ°í, 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¸¦ Çã¿ëÇϵµ·Ï ¾ÆÆÄÄ¡ ¼³Á¤Çϱâ</a></h2>
<p>CGI ÇÁ·Î±×·¥ÀÌ ¿Ã¹Ù·Î µ¿ÀÛÇÏ·Á¸é CGI ½ÇÇàÀÌ °¡´ÉÇϵµ·Ï
¾ÆÆÄÄ¡¸¦ ¼³Á¤ÇØ¾ß ÇÑ´Ù. ¼³Á¤ÇÏ´Â ¹æ¹ýÀº ¿©·¯°¡Áö´Ù.</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 ÇÁ·Î±×·¥¿ëÀ¸·Î
µÐ´Ù. ¾ÆÆÄÄ¡´Â ÀÌ µð·ºÅ丮¿¡ ÀÖ´Â ¸ðµç ÆÄÀÏÀÌ 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>À§ ¿¹Á¦´Â ¾ÆÆÄÄ¡¸¦ ±âº» Àå¼Ò¿¡ ¼³Ä¡ÇÑ °æ¿ì
<code>httpd.conf</code> ¼³Á¤ÆÄÀÏ¿¡ ÀÖ´Â ³»¿ëÀÌ´Ù. <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code> Áö½Ã¾î´Â <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code> Áö½Ã¾î¿Í °°ÀÌ URL
¾ÕºÎºÐÀ» ƯÁ¤ µð·ºÅ丮·Î ´ëÀÀÇÑ´Ù.
<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 ÇÁ·Î±×·¥À¸·Î ó¸®Ç϶ó°í ¾Ë¸°´Ù.</p>
<p>¿¹¸¦ µé¾î, URL
<code>http://www.example.com/cgi-bin/test.pl</code>À»
¿äûÇÏ¸é ¾ÆÆÄÄ¡´Â
<code>/usr/local/apache2/cgi-bin/test.pl</code> ÆÄÀÏÀ»
½ÇÇàÇÏ¿© °á°ú¸¦ ¹ÝȯÇÑ´Ù. ¹°·Ð ÆÄÀÏÀÌ Á¸ÀçÇÏ°í ½ÇÇà°¡´ÉÇϸç
¾î¶² ¹æ¹ýÀ¸·Îµç Ãâ·ÂÀ» ÇØ¾ß ÇÑ´Ù. ±×·¸Áö ¾ÊÀ¸¸é ¾ÆÆÄÄ¡´Â
¿À·ù¹®À» º¸³½´Ù.</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">Options¸¦ »ç¿ëÇÏ¿© ¸í½ÃÀûÀ¸·Î CGI ½ÇÇàÀ» Çã¿ëÇϱâ</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 ÆÄÀÏÀÇ ½ÇÇàÀ» Çã¿ëÇÑ´Ù. ¾î¶²
ÆÄÀÏÀÌ 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">»ç¿ëÀÚ µð·ºÅ丮</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>´ÙÀ½Àº ºê¶ó¿ìÀú¿¡ ÇÑ ÁÙÀ» Âï´Â 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¿¡ Àͼ÷ÇÏÁö ¾Ê´õ¶óµµ ¹«½¼ ÀÏÀÌ ÀϾ´ÂÁö ¾Ë ¼ö
ÀÖ´Ù. ù¹ø° ÁÙÀº ¾ÆÆÄÄ¡(ȤÀº »ç¿ëÇÏ´Â ½©)¿¡°Ô
<code>/usr/bin/perl</code> À§Ä¡¿¡ ÀÖ´Â ÀÎÅÍÇÁ¸®ÅÍÀ» »ç¿ëÇÏ¿©
ÀÌ ÇÁ·Î±×·¥ ÆÄÀÏÀ» ½ÇÇàÇ϶ó°í ¾Ë¸°´Ù. µÎ¹ø° ÁÙÀº ¹æ±Ý
¸»ÇÑ content-type ¼±¾ðÀ» Ãâ·ÂÇÏ°í carriage-return ÁٹٲÞÀ»
µÎ¹ø Ãâ·ÂÇÑ´Ù. ±×·¯¸é Çì´õ µÚ¿¡ HTTP Çì´õÀÇ ³¡À» ¶æÇÏ´Â
ºóÁÙÀÌ »ý±â°í, º»¹®ÀÌ ½ÃÀÛÇÑ´Ù. ¼¼¹ø° ÁÙÀº "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>
ÇÑ ÁÙÀÌ º¸ÀδÙ. ÈïºÐµÇÁö´Â ¾ÊÁö¸¸, Çѹø µ¿ÀÛÇÏ´Â °ÍÀ»
º¸¾ÒÀ¸´Ï ÀÌÁ¦ ´Ù¸¥ °ÍÀ» ½ÃµµÇØ º¼ ¼ö ÀÖ´Ù.</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>ÁÁ´Ù! ¸ðµç °ÍÀÌ Àß µ¿ÀÛÇÑ´Ù´Â ¶æÀÌ´Ù. Ãâ·ÂÀº Á¤È®ÇÏÁö¸¸
ºê¶ó¿ìÀú°¡ ¿Ã¹Ù·Î ó¸®ÇÏÁö ¸øÇÑ´Ù¸é, CGI ÇÁ·Î±×·¥¿¡¼
¿Ã¹Ù¸¥ <code>Content-Type</code>À» ¼³Á¤ÇÏ¿´´ÂÁö È®ÀÎÇÑ´Ù.</dd>
<dt>CGI ÇÁ·Î±×·¥ ¼Ò½ºÄÚµå ȤÀº "POST Method Not Allowed"
¹®±¸</dt>
<dd>CGI ÇÁ·Î±×·¥À» ½ÇÇàÇϵµ·Ï ¾ÆÆÄÄ¡¸¦ ÀûÀýÈ÷ ¼³Á¤ÇÏÁö
¾Ê¾Ò´Ù´Â ¶æÀÌ´Ù. <a href="#configuring">¾ÆÆÄÄ¡ ¼³Á¤Çϱâ</a>
ÀýÀ» ´Ù½Ã ÀÐ°í »©¸ÔÀº ºÎºÐÀÌ ÀÖ´ÂÁö ã¾ÆºÁ¶ó.</dd>
<dt>"Forbidden"À¸·Î ½ÃÀÛÇÏ´Â ¹®±¸</dt>
<dd>±ÇÇÑ ¹®Á¦°¡ ÀÖ´Ù´Â ¶æÀÌ´Ù. <a href="#errorlogs">¾ÆÆÄÄ¡
¿À·ù ·Î±×</a>¿Í ¾Æ·¡ <a href="#permissions">ÆÄÀϱÇÇÑ</a>
ÀýÀ» È®ÀÎÇ϶ó.</dd>
<dt>"Internal Server Error"¶ó´Â ¹®±¸</dt>
<dd><a href="#errorlogs">¾ÆÆÄÄ¡ ¿À·ù ·Î±×</a>¸¦ º¸¸é ¾Æ¸¶µµ
CGI ÇÁ·Î±×·¥ÀÌ Ãâ·ÂÇÑ ¿À·ù¹®°ú ÇÔ²² "Premature end of
script headers"°¡ º¸ÀÏ °ÍÀÌ´Ù. ÀÌ °æ¿ì ¾Æ·¡ ³»¿ëµéÀ» Çϳª¾¿
È®ÀÎÇÏ¿© ¾î¶² ÀÌÀ¯·Î 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>°¡ ´Ù¸¦ ¼ö ÀÖ´Ù. (¿¹¸¦ µé¾î,
<code>sendmail</code> °°ÀÌ) CGI ÇÁ·Î±×·¥ ¾È¿¡¼ ½ÇÇàÇÏ´Â
¸í·É¾î´Â ¿ÏÀüÇÑ °æ·Î·Î ¸í½ÃÇØ¾ß ½©ÀÌ ¸í·É¾î¸¦ ãÀ» ¼ö
ÀÖ´Ù.</p>
<p>°æ·Î ¹®Á¦´Â ´ÙÀ½°ú °°ÀÌ CGI ÇÁ·Î±×·¥ ù¹ø° ÁÙ¿¡ ³ª¿À´Â
½ºÅ©¸³Æ® ÀÎÅÍÇÁ¸®ÅÍ (º¸Åë <code>perl</code>) °æ·Î¿¡¼
ÀÚÁÖ ¹ß»ýÇÑ´Ù.</p>
<div class="example"><p><code>
#!/usr/bin/perl
</code></p></div>
<p>½ÇÁ¦·Î ÀÎÅÍÇÁ¸®ÅÍÀÇ °æ·ÎÀÎÁö È®ÀÎÇÑ´Ù.</p>
<p>¶Ç, CGI ÇÁ·Î±×·¥ÀÌ ´Ù¸¥ <a href="#env">ȯ°æº¯¼ö</a>¸¦
»ç¿ëÇÑ´Ù¸é ¾ÆÆÄÄ¡°¡ ÀÌ º¯¼öµéÀ» ÇÁ·Î±×·¥¿¡°Ô Àü´ÞÇؾß
ÇÑ´Ù.</p>
<h3><a name="syntaxerrors" id="syntaxerrors">ÇÁ·Î±×·¥ ¿À·ù</a></h3>
<p>CGI ÇÁ·Î±×·¥ÀÌ ½ÇÆÐÇÏ´Â °æ¿ì ´ëºÎºÐ ÇÁ·Î±×·¥ ÀÚü
¹®Á¦¶§¹®ÀÌ´Ù. ƯÈ÷ À§ÀÇ µÎ°¡Áö ½Ç¼ö¸¦ ÇÏÁö ¾Ê¾Ò°í ÀÌ ±ÛÀ»
°è¼Ó º¸°í ÀÖ´Ù¸é ´õ´õ¿í ±×·¸´Ù. ¸ÕÀú À¥¼¹ö¿¡¼ ½ÇÇàÇϱâ
Àü¿¡ ¸í·ÉÇà¿¡¼ ÇÁ·Î±×·¥À» ½ÇÇàÇغ»´Ù. ¿¹¸¦ µé¾î, ´ÙÀ½°ú
°°ÀÌ ½ÇÇàÇÑ´Ù.</p>
<div class="example"><p><code>
cd /usr/local/apache2/cgi-bin<br />
./first.pl
</code></p></div>
<p>(<code>perl</code> ÀÎÅÍÇÁ¸®Å͸¦ ½ÇÇàÇÏÁö ¸¶¶ó. ½©°ú
¾ÆÆÄÄ¡´Â ½ºÅ©¸³Æ® ù¹ø° ÁÙ¿¡ ÀÖ´Â <a href="#pathinformation">°æ·Î Á¤º¸</a>¸¦ »ç¿ëÇÏ¿© ÀÎÅÍÇÁ¸®Å͸¦
ã¾Æ¾ß ÇÑ´Ù.)</p>
<p>ÇÁ·Î±×·¥Àº Á¦ÀÏ ¸ÕÀú <code>Content-Type</code>À» Æ÷ÇÔÇÑ
HTTP Çì´õµéÀ» Ãâ·ÂÇÏ°í ºó ÁÙÀ» Ãâ·ÂÇØ¾ß ÇÑ´Ù. ´Ù¸¥ °ÍÀ»
Ãâ·ÂÇÑ´Ù¸é À¥¼¹ö¿¡¼ ½ÇÇàÇÒ °æ¿ì ¾ÆÆÄÄ¡´Â <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> À§Ä¡¸¦ È®ÀÎÇÑ´Ù. ¾ÆÆÄÄ¡°¡
½ÃÀÛÇÒ¶§ ±× Àå¼Ò¿¡¼ suexec ½ÇÇàÆÄÀÏÀ» ¹ß°ßÇϸé, suexec¸¦
»ç¿ëÇÒ ¼ö ÀÖ´Ù.</p>
<p>suexec¸¦ ¿ÏÀüÈ÷ ÀÌÇØÇÏÁö ¸øÇß´Ù¸é »ç¿ëÇؼ´Â ¾ÈµÈ´Ù.
suexec¸¦ »ç¿ëÇÏÁö ¾ÊÀ¸·Á¸é <code>SUEXEC_BIN</code> À§Ä¡¿¡
ÀÖ´Â <code>suexec</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">µÚ¿¡¼´Â ¹«½¼ ÀÏÀÌ ¹ú¾îÁö´Â°¡?</a></h2>
<p>CGI ÇÁ·Î±×·¡¹Ö¿¡ Àͼ÷ÇØÁú¼ö·Ï µÚ¿¡¼ ¹ú¾îÁö´Â ÀÏÀ» ÀÌÇØÇϸé
µµ¿òÀÌ µÈ´Ù. ±¸Ã¼ÀûÀ¸·Î ºê¶ó¿ìÀú¿Í ¼¹ö°¡ ¼·Î Åë½ÅÇÏ´Â
¹æ¹ýÀ» ¸»ÇÏ´Â °ÍÀÌ´Ù. ¸ô¶óµµ "Hello, World."¸¦ Ãâ·ÂÇÏ´Â
ÇÁ·Î±×·¥À» ÀÛ¼ºÇÒ ¼ö ÀÖÁö¸¸ ÀÌ·± ÇÁ·Î±×·¥Àº º°·Î ¾µ¸ð°¡
¾ø±â¶§¹®ÀÌ´Ù.</p>
<h3><a name="env" id="env">ȯ°æº¯¼ö</a></h3>
<p>ȯ°æº¯¼ö´Â ´ç½ÅÀÌ ÄÄÇ»Å͸¦ »ç¿ëÇÏ´Â µ¿¾È ´ç½Å ÁÖÀ§¸¦
¶°´Ù´Ï´Â °ªÀÌ´Ù. ȯ°æº¯¼ö´Â path (ÄÄÇ»ÅÍ°¡ ´ç½ÅÀÌ ÀÔ·ÂÇÑ
¸í·É¾î¿¡ ÇØ´çÇÏ´Â ½ÇÁ¦ ÆÄÀÏÀ» ã´Â Àå¼Ò), »ç¿ëÀÚ¸í, Å͹̳Î
Á¾·ù¿Í °°ÀÌ À¯¿ëÇÑ Á¤º¸´Ù. ÀϹÝÀûÀΠȯ°æº¯¼ö¸¦ ¸ðµÎ º¸·Á¸é
¸í·ÉÇà ÇÁ·ÒÇÁÆ®¿¡¼ <code>env</code>¸¦ ÀÔ·ÂÇÑ´Ù.</p>
<p>CGI¸¦ ½ÇÇàÇÒ¶§µµ ¼¹ö¿Í ºê¶ó¿ìÀú´Â °¢ÀÚÀÇ È¯°æº¯¼ö¸¦
¼·Î ±³È¯ÇÑ´Ù. ÀÌ Á¤º¸¿¡´Â ºê¶ó¿ìÀú Á¾·ù (Netscape, IE,
Lynx), ¼¹ö Á¾·ù (¾ÆÆÄÄ¡, 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 ÇÁ·Î±×·¥Àº Àڽſ¡°Ô Àü´ÞµÈ ¸ðµç
ȯ°æº¯¼ö¸¦ º¸¿©ÁØ´Ù. ¾ÆÆÄÄ¡ ¹èÆ÷º»ÀÇ <code>cgi-bin</code>
µð·ºÅ丮¿¡ ÀÌ¿Í ºñ½ÁÇÑ ÇÁ·Î±×·¥ÀÌ µÎ°³ ÀÖ´Ù. ¸î¸î º¯¼ö´Â
ÇʼöÀÌ°í ³ª¸ÓÁö´Â ¼±ÅÃÀûÀÌ´Ù. ±×·¡¼ °ø½Ä ¸ñ·Ï¿¡ ¾ø´Â
º¯¼öµµ º¸ÀδÙ. ¶Ç, ¾ÆÆÄÄ¡´Â ±âº»ÀûÀ¸·Î Á¦°øÇϴ ȯ°æº¯¼ö
¿Ü¿¡ ¿©·¯°¡Áö ¹æ¹ýÀ¸·Î <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 ÇÁ·Î±×·¥¿¡°Ô À¥ ¾ç½Ä(form)À» <code>POST</code>Çϸé
¾ç½Ä¿¡ ÀÔ·ÂÇÑ ÀڷḦ Ưº°ÇÑ Çü½ÄÀ¸·Î ¹¾î¼ CGI ÇÁ·Î±×·¥ÀÇ
<code>STDIN</code>À¸·Î Àü´ÞÇÑ´Ù. ±×·¯¸é ÇÁ·Î±×·¥Àº Å°º¸µå³ª
ÆÄÀÏ¿¡¼ ¾òÀº ÀڷḦ ó¸®ÇϵíÀÌ ÀڷḦ ó¸®ÇÒ ¼ö ÀÖ´Ù.</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> ¿äûÀ̶ó°í ÇÑ´Ù. <code>FORM</code>
ű×ÀÇ <code>METHOD</code> ¼Ó¼ºÀ» ÁöÁ¤ÇÏ¿© HTML ¾ç½Ä(form)ÀÌ
ÀڷḦ <code>GET</code>ÇÒÁö <code>POST</code>ÇÒÁö °áÁ¤ÇÑ´Ù.</p>
<p>ÀÌÁ¦ ÇÁ·Î±×·¥Àº ÀÌ·± ¹®ÀÚ¿À» À¯¿ëÇÑ Á¤º¸·Î ÂÉ°³¾ß
ÇÑ´Ù. ´ÙÇàÈ÷µµ ÀÌ·± ÀÚ·á 󸮸¦ µ½°í 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>¿¡¼ °ü·Ã ¸ðµâµéÀ» ãÀ»
¼ö ÀÖ´Ù. CGI °³¹ß¿¡ °¡Àå ³Î¸® »ç¿ëµÇ´Â ¸ðµâÀº
<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 Á¤º¸°¡ ÀÖ´Ù. ´º½º±×·ì <a href="news:comp.infosystems.www.authoring.cgi">comp.infosystems.www.authoring.cgi</a>¿¡¼ ¿©·¯ »ç¶÷µé°ú
CGI ¹®Á¦¸¦ ³íÀÇÇÒ ¼ö ÀÖ´Ù. HTML Writers GuildÀÇ -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>¾ÆÆÄÄ¡ ¼Ò½ºÄڵ尡 À߸øµÇ¾ú´Ù°í È®½ÅÇÏÁö ¾Ê´Â ÇÑ CGI Áú¹®À»
¾ÆÆÄÄ¡ ¹ö±× µ¥ÀÌÅͺ£À̽º¿¡ ¿Ã¸®¸é <strong>Àý´ë·Î</strong>
¾ÈµÈ´Ù.</p>
</div></div>
<div class="bottomlang">
<p><span>°¡´ÉÇÑ ¾ð¾î: </span><a href="../en/howto/cgi.html" hreflang="en" rel="alternate" title="English"> en </a> |
<a href="../fr/howto/cgi.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
<a href="../ja/howto/cgi.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
<a href="../ko/howto/cgi.html" title="Korean"> ko </a></p>
</div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
<script type="text/javascript"><!--//--><![CDATA[//><!--
var comments_shortname = 'httpd';
var comments_identifier = 'http://httpd.apache.org/docs/2.4/howto/cgi.html';
(function(w, d) {
if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
d.write('<div id="comments_thread"><\/div>');
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
(d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
}
else {
d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
}
})(window, document);
//--><!]]></script></div><div id="footer">
<p class="apache">Copyright 2014 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="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">¿ë¾î</a> | <a href="../sitemap.html">»çÀÌÆ®¸Ê</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
if (typeof(prettyPrint) !== 'undefined') {
prettyPrint();
}
//--><!]]></script>
</body></html>
|