安装Apache(1)

返回
CGIサンプルプログラム1 http://localhost/cgi-bin/printenv.pl ------------------------------------------------------------------------------ #!C:/Perl/bin/perl.exe ## ## printenv -- demo CGI program which just prints its environment ## ##print "Content-type: text/plain; charset=iso-8859-1\n\n"; ==>TEXT印刷はだめ! print "Content-Type: text/html\n\n"; foreach $var (sort(keys(%ENV))) { $val = $ENV{$var}; $val =~ s|\n|\\n|g; $val =~ s|"|\\"|g; print "-----------------------------------<br>"; # print "${var}=\"${val}\"\n"; print "${var}=\"${val}\"<br>"; } 出力 ------------------------------------------------------------------------------ COMSPEC="C:\WINDOWS\system32\cmd.exe" DOCUMENT_ROOT="C:/www/htdocs" GATEWAY_INTERFACE="CGI/1.1" HTTP_ACCEPT="image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/msword, */*" HTTP_ACCEPT_ENCODING="gzip, deflate" HTTP_ACCEPT_LANGUAGE="ja" HTTP_CONNECTION="Keep-Alive" HTTP_HOST="localhost" HTTP_USER_AGENT="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)" PATH="C:\Perl\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Ulead Systems\MPEG;C:\Program Files\Ulead Systems\Ulead DVD MovieWriter 3;C:\Program Files\MySQL\MySQL Server 5.0\bin" PATHEXT=".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH" QUERY_STRING="" REMOTE_ADDR="127.0.0.1" REMOTE_PORT="1922" REQUEST_METHOD="GET" REQUEST_URI="/cgi-bin/printenv.pl" SCRIPT_FILENAME="C:/www/cgi-bin/printenv.pl" SCRIPT_NAME="/cgi-bin/printenv.pl" SERVER_ADDR="127.0.0.1" SERVER_ADMIN="xxx@yahoo.co.jp" SERVER_NAME="localhost" SERVER_PORT="80" SERVER_PROTOCOL="HTTP/1.1" SERVER_SIGNATURE="" SERVER_SOFTWARE="Apache/2.2.4 (Win32)" SYSTEMROOT="C:\WINDOWS" WINDIR="C:\WINDOWS" CGIサンプルプログラム2 http://localhost/cgi-bin/Helloworld.pl ------------------------------------------------------------------------------ #!C:/Perl/bin/perl.exe $url = "http://$ENV{SERVER_NAME}$ENV{URL}"; $ip = "$ENV{REMOTE_ADDR}"; print <<ENDOFTEXT; Content-Type: text/html <HTML> <HEAD><TITLE>Hello World!</TITLE></HEAD> <BODY> <H4>Hello World!</H4> <P>You have reached <a href="$url">$url</a></P> <P>Your IP Address is $ip</P> <H5>Have a nice day!</H5> </BODY> </HTML> ENDOFTEXT exit(0); 出力 ------------------------------------------------------------------------------ Hello World! You have reached http://localhost Your IP Address is 127.0.0.1 Have a nice day! MSDOSプロンプトを起動して、コマンドラインに以下を打ち込んで実行すれば、mod_perl2 がインストールされます。「mod_perl.so」をどこに置くか聞かれますが、前述の位置に Apache2 を配置しているなら「C:\usr\Apache2\modules」とすればOK。 C:\>ppm3 install http://theoryx5.uwinnipeg.ca/ppms/mod_perl.ppd Installing Apache HTTP 2.0 server with DomainName = msc.local ServerName = SERVER.msc.local ServerAdmin = admin@msc.local ServerPort = 80 ServerSslPort = 80 ServerRoot = E:/www Rewrote E:/www/conf/default/httpd-autoindex.conf.in to E:/www/conf/default/httpd-autoindex.conf Successfully removed E:\www\conf\default\httpd-autoindex.conf.in Rewrote E:/www/conf/default/httpd-vhosts.conf.in to E:/www/conf/default/httpd-vhosts.conf Successfully removed E:\www\conf\default\httpd-vhosts.conf.in Rewrote E:/www/conf/default/httpd-default.conf.in to E:/www/conf/default/httpd-default.conf Successfully removed E:\www\conf\default\httpd-default.conf.in Rewrote E:/www/conf/default/httpd-manual.conf.in to E:/www/conf/default/httpd-manual.conf Successfully removed E:\www\conf\default\httpd-manual.conf.in Rewrote E:/www/conf/default/httpd-mpm.conf.in to E:/www/conf/default/httpd-mpm.conf Successfully removed E:\www\conf\default\httpd-mpm.conf.in Rewrote E:/www/conf/default/httpd-info.conf.in to E:/www/conf/default/httpd-info.conf Successfully removed E:\www\conf\default\httpd-info.conf.in Rewrote E:/www/conf/default/httpd-dav.conf.in to E:/www/conf/default/httpd-dav.conf Successfully removed E:\www\conf\default\httpd-dav.conf.in Rewrote E:/www/conf/default/httpd-languages.conf.in to E:/www/conf/default/httpd-languages.conf Successfully removed E:\www\conf\default\httpd-languages.conf.in Rewrote E:/www/conf/default/httpd-win.conf to E:/www/conf/default/httpd.conf Successfully removed E:\www\conf\default\httpd-win.conf Rewrote E:/www/conf/default/httpd-userdir.conf.in to E:/www/conf/default/httpd-userdir.conf Successfully removed E:\www\conf\default\httpd-userdir.conf.in Rewrote E:/www/conf/default/httpd-ssl.conf.in to E:/www/conf/default/httpd-ssl.conf Successfully removed E:\www\conf\default\httpd-ssl.conf.in Rewrote E:/www/conf/default/httpd-multilang-errordoc.conf.in to E:/www/conf/default/httpd-multilang-errordoc.conf Successfully removed E:\www\conf\default\httpd-multilang-errordoc.conf.in Duplicated E:/www/conf/default/magic to E:/www/conf/magic Duplicated E:/www/conf/default/httpd-autoindex.conf to E:/www/conf/extra/httpd-autoindex.conf Duplicated E:/www/conf/default/httpd-vhosts.conf to E:/www/conf/extra/httpd-vhosts.conf Duplicated E:/www/conf/default/httpd-default.conf to E:/www/conf/extra/httpd-default.conf Duplicated E:/www/conf/default/mime.types to E:/www/conf/mime.types Duplicated E:/www/conf/default/charset.conv to E:/www/conf/charset.conv Duplicated E:/www/conf/default/httpd-manual.conf to E:/www/conf/extra/httpd-manual.conf Duplicated E:/www/conf/default/httpd-mpm.conf to E:/www/conf/extra/httpd-mpm.conf Duplicated E:/www/conf/default/httpd-info.conf to E:/www/conf/extra/httpd-info.conf Duplicated E:/www/conf/default/httpd-dav.conf to E:/www/conf/extra/httpd-dav.conf Duplicated E:/www/conf/default/httpd-languages.conf to E:/www/conf/extra/httpd-languages.conf Duplicated E:/www/conf/default/httpd.conf to E:/www/conf/httpd.conf Duplicated E:/www/conf/default/httpd-userdir.conf to E:/www/conf/extra/httpd-userdir.conf Duplicated E:/www/conf/default/httpd-ssl.conf to E:/www/conf/extra/httpd-ssl.conf Duplicated E:/www/conf/default/httpd-multilang-errordoc.conf to E:/www/conf/extra/httpd-multilang-errordoc.conf Successfully removed E:\www\conf\default\InstallConf22.awk

返回