フリーCGIスクリプト配布サイト。
C:\Program Files\Apache Group\Apache2\cgi-bin
フォルダ内に sample.cgi
を作成し、以下の内容を記述します。
#!/perl/bin/perl
print "Content-Type: text/html\n\n";
print "<html>";
print "<head><title>サンプル</title></head>";
print "<body>";
print "<p>初めてのCGI。</p>";
print "</body>";
print "</html>";
exit;
次にブラウザソフトを起動し、アドレス欄に http://127.0.0.1/cgi-bin/sample.cgi
と入力します。以下のように表示されれば成功です。
これで、Windows上でCGIを動作させる環境ができました。
なお、CGIプログラムが実行できる場所は C:\Program Files\Apache Group\Apache2\cgi-bin
フォルダ内に限られますが、この制限は解除する事ができます。