{"id":44,"date":"2006-04-28T16:26:20","date_gmt":"2006-04-28T07:26:20","guid":{"rendered":"http:\/\/mike.md.tsukuba.ac.jp\/terui\/blog\/?p=44"},"modified":"2021-12-31T06:43:52","modified_gmt":"2021-12-30T21:43:52","slug":"cgi","status":"publish","type":"post","link":"https:\/\/nbsigh2.com\/?p=44","title":{"rendered":"CGI"},"content":{"rendered":"<p>CGI \u3092\u5404\u30e6\u30fc\u30b6\u306eSites \u3067\u6709\u52b9\u306b\u3059\u308b\u3002<br \/>\n\/etc\/httpd\/httpd.conf<br \/>\n\u3092\u66f8\u304d\u63db\u3048\u305f\u3002<br \/>\nDefault \u3067\u306f\u3001\/Library\/WebServer\/CGI-Executable \u306b\u304a\u3044\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u6709\u52b9\u3000\u3068\u8a2d\u5b9a\u3057\u3066\u3042\u3063\u305f\u3002<br \/>\n\u3053\u308c\u3092\u3001\u5404\u30e6\u30fc\u30b6\u306eSites\/cgi-bin \u5185\u306b\u7f6e\u3044\u305fcgi\u30d5\u30a1\u30a4\u30eb\u306e\u307f\u6709\u52b9\u306b\u3059\u308b\u3068\u3057\u305f\u3002<br \/>\n\/etc\/httpd\/httpd.conf<br \/>\n\u306e\uff16\uff12\uff15\u884c\u76ee\u3042\u305f\u308a<br \/>\n## ScriptAlias: This controls which directories contain server scripts. ## ScriptAliases are essentially the same as Aliases, except that ## documents in the realname directory are treated as applications and ## run by the server when requested rather than as documents sent to the client. ## The same rules about trailing &#8220;\/&#8221; apply to ScriptAlias directives as to ## Alias. ## # ScriptAlias \/cgi-bin\/ &#8220;\/Library\/WebServer\/CGI-Executables\/&#8221; ScriptAlias \/cgi-bin\/ &#8220;\/Users\/*\/Sites\/cgi-bin&#8221; ## ## This should be changed to whatever your ScriptAliased ## CGI directory exists, if you have that configured. ## # &lt;Directory &#8220;\/Library\/WebServer\/CGI-Executables&#8221; &lt;Directory &#8220;\/Users\/*\/Sites\/cgi-bin&#8221; # AllowOverride None AllowOverride All Options None Order allow,deny Allow from all &lt;\/Directory&gt; \u3055\u3089\u306b\u3001\u3053\u306e\u30b5\u30fc\u30d0\u56fa\u6709\u306e\u8a2d\u5b9a\u304c\u8a18\u5165\u3055\u308c\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u3092\/etc\/httpd\/sites\/ \u304b\u3089\u3055\u304c\u3057\u305f\u3002<br \/>\n0000_192.168.0.2_80_mike.md.tsukuba.ac.jp.conf \u3067\u3042\u308b\u3002<br \/>\n\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u8b77\u9818\u57df\u306e\u8a2d\u5b9a\u304c\u8a18\u5165\u3055\u308c\u3066\u3044\u308b\u3002<br \/>\n\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\uff12\uff12\u884c\u76ee\u3042\u305f\u308a\u306f\u3001<br \/>\n\u3000\u3000\u3000&lt;Directory &#8220;\/Library\/WebServer\/Documents&#8221;&gt; Options All -Indexes +ExecCGI +Includes +MultiViews # AllowOverride None AllowOverride All &lt;IfModule mod_dav.c&gt; DAV On &lt;\/IfModule&gt; &lt;\/Directory&gt; \u3068\u306a\u3063\u3066\u3044\u308b\u3002\u8a66\u884c\u932f\u8aa4\u306e\u7d50\u679c\u3060\u3002<br \/>\nCGI \u304c\u3046\u3054\u3044\u3066\u3044\u308b\u3053\u3068\u306e\u78ba\u8a8d<br \/>\ntest.cgi \u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3002\u5185\u5bb9\u306f\u3001<br \/>\n\u3000\u3000\u3000\u3000#! \/usr\/bin\/perl \u3000\u3000\u3000\u3000print &#8220;Content-type: text\/plainnn&#8221;; \u3000\u3000\u3000\u3000print &#8220;Hellow World&#8221;; \u3000\u3000\u3000\u3000exit; \u3067\u3042\u308b\u3002\u6539\u884c\u306fUNIX\u306b\u3059\u308b\u3053\u3068\u3002<br \/>\n\u3000\u3000&lt;a href=&#8221;cgi-bin\/test.cgi&#8221;&gt;Test script&lt;\/a&gt; \u3068\u3069\u3063\u304b\u306e\u30da\u30fc\u30b8\u306b\u66f8\u304d\u3002\u3053\u308c\u3092\u8868\u793a\u3057\u3066\u30af\u30ea\u30c3\u30af\u3059\u308c\u3070\u3000Hellow World \u3068\u8868\u793a\u3055\u308c\u305f\u30da\u30fc\u30b8\u304c\u51fa\u73fe\u3059\u308b\u3002\u3053\u308c\u304c\u3046\u307e\u304f\u3044\u3051\u3070\u3044\u3044\u3002<br \/>\n CGI \u30a8\u30e9\u30fc\u30ed\u30b0<br \/>\n\u25cb\u30b5\u30fc\u30d0\u7ba1\u7406 \u30fc\uff1e Web -> \u30ed\u30b0 -> \u30a2\u30af\u30bb\u30b9<br \/>\n130.158.152.137 &#8211; &#8211; [22\/Jun\/2006:08:41:42 +0900] &#8220;GET \/sigh\/cgi-bin\/test.cgi HTTP\/1.1&#8221; 200 24 &#8220;-&#8221; &#8220;Mozilla\/5.0 (Macintosh; U; PPC Mac OS X Mach-O; ja-JP-mac; rv:1.8.0.4) Gecko\/20060508 Firefox\/1.5.0.4&#8221;<br \/>\n130.158.152.137 &#8211; &#8211; [22\/Jun\/2006:08:42:07 +0900] &#8220;GET \/sigh\/cgi-bin\/light.cgi HTTP\/1.1&#8221; 404 &#8211; &#8220;-&#8221; &#8220;Mozilla\/5.0 (Macintosh; U; PPC Mac OS X Mach-O; ja-JP-mac; rv:1.8.0.4) Gecko\/20060508 Firefox\/1.5.0.4&#8221;<br \/>\n130.158.152.137 &#8211; &#8211; [22\/Jun\/2006:08:42:15 +0900] &#8220;GET \/sigh\/cgi-bin\/bbs\/light.cgi HTTP\/1.1&#8221; 500 629 &#8220;-&#8221; &#8220;Mozilla\/5.0 (Macintosh; U; PPC Mac OS X Mach-O; ja-JP-mac; rv:1.8.0.4) Gecko\/20060508 Firefox\/1.5.0.4&#8221;<br \/>\n\u25cb\u30b5\u30fc\u30d0\u7ba1\u7406 \u30fc\uff1e Web -> \u30ed\u30b0 -> \u30a8\u30e9\u30fc<br \/>\n[Thu Jun 22 08:42:07 2006] [error] [client 130.158.152.137] File does not exist: \/Library\/WebServer\/Documents\/error.html<br \/>\n[Thu Jun 22 08:42:15 2006] [error] (2)No such file or directory: exec of \/Library\/WebServer\/Documents\/sigh\/cgi-bin\/bbs\/light.cgi failed<br \/>\n[Thu Jun 22 08:42:15 2006] [error] [client 130.158.152.137] Premature end of script headers: \/Library\/WebServer\/Documents\/sigh\/cgi-bin\/bbs\/light.cgi<br \/>\n\u6587\u6cd5\u30c1\u30a7\u30c3\u30af<br \/>\n# perl -wc [\u30d5\u30a1\u30a4\u30eb\u540d]<br \/>\n\u306e\u30b3\u30de\u30f3\u30c9\u3067syntax error \u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b<br \/>\nPremature end of script headers\u3000\u3068\u3044\u3046\u30a8\u30e9\u30fc\u306f<br \/>\n\uff11\u884c\u76ee\u306e#! \/usr\/bin\/perl\u3000\u304c\u8aa4\u308a\u3067\u3042\u308b\u3002<br \/>\nName &#8220;main::mode&#8221; used only once: possible typo at init.cgi line 125. \u3068\u3044\u3046\u30a8\u30e9\u30fc\u304c\u3067\u3066\u3082\u6c17\u306b\u3057\u306a\u3044\u3002\u3053\u308c\u306f\u5909\u6570\u306b\u6307\u5b9a\u3057\u3066\u3042\u308b\u304c\uff11\u56de\u3057\u304b\u3064\u304b\u3063\u3066\u306a\u3044\u3051\u3069\u3044\u3044\u306e\u304b\uff1f\u3000\u3068\u3044\u3046\u610f\u5473\u3060\u304b\u3089<br \/>\nsyntax OK\u3000\u3068\u306a\u308c\u3070\u3044\u3044\u3002<br \/>\napache\u306e\u518d\u8d77\u52d5<br \/>\n# \/usr\/sbin\/apachctl restart<br \/>\n\/usr\/sbin\/apachectl restart:httpd restarted<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\t\t\t\t<![CDATA[]]>\t\t<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-44","post","type-post","status-publish","format-standard","hentry","category-6"],"_links":{"self":[{"href":"https:\/\/nbsigh2.com\/index.php?rest_route=\/wp\/v2\/posts\/44","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nbsigh2.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nbsigh2.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nbsigh2.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nbsigh2.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=44"}],"version-history":[{"count":2,"href":"https:\/\/nbsigh2.com\/index.php?rest_route=\/wp\/v2\/posts\/44\/revisions"}],"predecessor-version":[{"id":22506,"href":"https:\/\/nbsigh2.com\/index.php?rest_route=\/wp\/v2\/posts\/44\/revisions\/22506"}],"wp:attachment":[{"href":"https:\/\/nbsigh2.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nbsigh2.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nbsigh2.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}