File: /opt/bitnami/apache/manual/howto/cgi.html.ko.euc-kr
<!DOCTYPE html SYSTEM "about:legacy-compat">
<html lang="ko"><head><META http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<meta content="width=device-width, initial-scale=1" name="viewport">
<!--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->
<title>����ġ ��丮��: CGI�� ����� ���� ���� ���� - Apache HTTP Server Version 2.4</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">
</script>
<link href="../images/favicon.png" 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="https://cwiki.apache.org/confluence/display/httpd/FAQ">FAQ</a> | <a href="../glossary.html">���</a> | <a href="../sitemap.html">���Ʈ��</a> | <a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2">Report a bug</a></p>
<p class="apache">Apache HTTP Server Version 2.4</p>
<img alt="" src="../images/feather.png"></div>
<div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif"></a></div>
<div id="path">
<a href="https://www.apache.org/">Apache</a> > <a href="https://httpd.apache.org/">HTTP Server</a> > <a href="https://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>
<button aria-label="Toggle language list" class="lang-toggle"><svg xmlns="http://www.w3.org/2000/svg" stroke-width="2" stroke="currentColor" fill="none" viewBox="0 0 24 24" height="16" width="16"><circle r="10" cy="12" cx="12"/><line y2="12" x2="22" y1="12" x1="2"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg></button>
<div class="toplang">
<p><span>������ ���: </span><a href="../en/howto/cgi.html" hreflang="en" rel="alternate" title="English"> en </a> |
<a href="../es/howto/cgi.html" hreflang="es" rel="alternate" title="Español"> es </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></div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif"></a></div>
<div class="section">
<h2 id="intro">�Ұ� <a title="Permanent link" href="#intro" class="permalink">¶</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 id="configuring">CGI�� ����ϵ��� ����ġ �����ϱ� <a title="Permanent link" href="#configuring" class="permalink">¶</a></h2>
<p>CGI ��α��� �ùٷ� �����Ϸ��� CGI ����� �����ϵ���
����ġ�� �����ؾ� �Ѵ�. �����ϴ� ���� ����������.</p>
<h3 id="scriptalias">ScriptAlias</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 id="nonscriptalias">ScriptAlias ���丮 �ۿ� �ִ� CGI</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 id="options">Options�� ����Ͽ� �������� CGI ���� ����ϱ�</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 id="htaccess">.htaccess ���</h3>
<p><a href="htaccess.html"><code>.htaccess</code> ��丮��</a>��
<code>httpd.conf</code>�� ���ٱ���� ���� ��쿡 CGI ��α���
����� �� �ִ� ���� �˷��ش�.</p>
<h3 id="userdir">���� ���丮</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 id="writing">CGI ��α� �ۼ��ϱ� <a title="Permanent link" href="#writing" class="permalink">¶</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 id="firstcgi">ó������ ���� CGI ��α�</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 id="troubleshoot">���� ��� ������� �ʾƿ�! <a title="Permanent link" href="#troubleshoot" class="permalink">¶</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 id="permissions">��ϱ���</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 id="pathinformation">��� ������ ȯ��</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 id="syntaxerrors">��α� ����</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 id="errorlogs">���� �α�</h3>
<p>���� �α״� ��� ��̴�. ���� �߸��Ǹ� ���� �α�
������ �����. ���� �α� ���� ��� ������ �Ѵ�. �����Ʈ��
ȣ�����ϴ� ������ ���� �α� ���� ���ϰ� �Ѵٸ�, �Ƹ���
�ٸ� ��ü�� �˾ƺ��� �Ѵ�. ���� �α� ���� ���� �����,
��κ�� ������ ���� �ľ��Ͽ� �ذ��� �� �ִ�.</p>
<h3 id="suexec">Suexec</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 id="behindscenes">�ڿ����� ���� ��� �����°�? <a title="Permanent link" href="#behindscenes" class="permalink">¶</a></h2>
<p>CGI ��α��ֿ� �ͼ�������� �ڿ��� ������ ��� �����ϸ�
����� �ȴ�. ��ü������ ������ ������ ���� ����ϴ�
���� ���ϴ� ��̴�. ��� "Hello, World."�� ����ϴ�
��α��� �ۼ��� �� ����� �̷� ��α��� ���� ����
������̴�.</p>
<h3 id="env">ȯ�溯��</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 id="stdin">STDIN�� STDOUT</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 id="libraries">CGI ���/��̺귯�� <a title="Permanent link" href="#libraries" class="permalink">¶</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 id="moreinfo">�� ���� ����... <a title="Permanent link" href="#moreinfo" class="permalink">¶</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="../es/howto/cgi.html" hreflang="es" rel="alternate" title="Español"> es </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 id="footer">
<p class="apache">Copyright 2026 The Apache Software Foundation.<br>Licensed under the <a href="https://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="https://cwiki.apache.org/confluence/display/httpd/FAQ">FAQ</a> | <a href="../glossary.html">���</a> | <a href="../sitemap.html">���Ʈ��</a> | <a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2">Report a bug</a></p></div><script><!--//--><![CDATA[//><!--
if (typeof(prettyPrint) !== 'undefined') {
prettyPrint();
}
var langToggle = document.querySelector('.lang-toggle');
var topLang = document.querySelector('.toplang');
if (langToggle && topLang) {
langToggle.addEventListener('click', function() { topLang.classList.toggle('open'); });
}
var qv = document.getElementById('quickview');
if (qv) {
document.body.appendChild(qv);
var qvBtn = document.createElement('button');
qvBtn.className = 'qv-toggle';
qvBtn.setAttribute('aria-label', 'Toggle page navigation');
qvBtn.innerHTML = '☰';
document.body.appendChild(qvBtn);
qvBtn.addEventListener('click', function() {
var isOpen = qv.classList.toggle('open');
if (isOpen) {
qv.style.top = window.scrollY + 10 + 'px';
}
});
window.addEventListener('scroll', function() { qv.classList.remove('open'); });
}
//--><!]]></script>
</body></html>