<?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>
<meta content="text/html; charset=EUC-KR" http-equiv="Content-Type" />
<!--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->
<title>����ġ ���丮��: CGI�� ����� ���� ������ �� - Apache HTTP Server Version 2.5</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/quickreference.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.5</p>
<img alt="" src="/images/feather.gif" /></div>
<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
<div id="path">
<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.5</a> &gt; <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">&nbsp;en&nbsp;</a> |
<a href="/fr/howto/cgi.html" hreflang="fr" rel="alternate" title="Fran&#231;ais">&nbsp;fr&nbsp;</a> |
<a href="/ja/howto/cgi.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="/ko/howto/cgi.html" title="Korean">&nbsp;ko&nbsp;</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>
&lt;Directory /usr/local/apache2/htdocs/somedir&gt;<br />
<span class="indent">
Options +ExecCGI<br />
</span>
&lt;/Directory&gt;
</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>
&lt;Directory /home/*/public_html&gt;<br />
<span class="indent">
Options +ExecCGI<br />
AddHandler cgi-script .cgi<br />
</span>
&lt;/Directory&gt;
</code></p></div>
<p>������ ����ϸ� ����� ���丮�� <code>cgi-bin</code>
�������丮�� �ִ� ��� ������ CGI ���α׷����� �ν��Ѵ�.</p>
<div class="example"><p><code>
&lt;Directory /home/*/public_html/cgi-bin&gt;<br />
<span class="indent">
Options ExecCGI<br />
SetHandler cgi-script<br />
</span>
&lt;/Directory&gt;
</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 --&gt; $ENV{$key}&lt;br&gt;";<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>"Ư���� ���"�� �ſ� �����ϴ�. �׸� �̸��� ���� ��ȣ(=)��
�����ϰ�, �׸� �̸��� ���� �ֵ��� ���� ���ۻ���(&amp;)��
�����Ѵ�. ���, ���ۻ���, ��ȣ ���� ���ڿ������� ���ڴ�
ȥ������ �ʵ��� 16����� ��ȯ�Ѵ�. ������ �ڷ� ���ڿ���
������ ���� ����.</p>
<div class="example"><p><code>
name=Rich%20Bowen&amp;city=Lexington&amp;state=KY&amp;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">&nbsp;en&nbsp;</a> |
<a href="/fr/howto/cgi.html" hreflang="fr" rel="alternate" title="Fran&#231;ais">&nbsp;fr&nbsp;</a> |
<a href="/ja/howto/cgi.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="/ko/howto/cgi.html" title="Korean">&nbsp;ko&nbsp;</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&amp;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/trunk/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 2015 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/quickreference.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>