/usr/share/doc/libapache2-mod-perl2-doc/docs/2.0/os/win32/config.html is in libapache2-mod-perl2-doc 2.0.9~1624218-2+deb8u2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | <?xml version="1.0" ?>
<!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">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body>
<ul id="index">
<li><a href="#NAME">NAME</a></li>
<li><a href="#Description">Description</a></li>
<li><a href="#Configuration">Configuration</a></li>
<li><a href="#Registry-scripts">Registry scripts</a></li>
<li><a href="#Hello-World">Hello World</a></li>
<li><a href="#See-Also">See Also</a></li>
<li><a href="#Maintainers">Maintainers</a></li>
<li><a href="#Authors">Authors</a></li>
</ul>
<h1 id="NAME">NAME</h1>
<p>Configuring mod_perl 2.0 for Win32</p>
<h1 id="Description">Description</h1>
<p>This document discusses how to configure mod_perl 2.0.</p>
<h1 id="Configuration">Configuration</h1>
<p>Add this line to <i>C:/Apache2/conf/httpd.conf</i>:</p>
<pre><code> LoadModule perl_module modules/mod_perl.so</code></pre>
<p>Be sure that the path to your Perl binary (eg, <i>C:/Perl/bin</i>) is in your <code>PATH</code> environment variable. This can be done either by editing <i>C:\AutoExec.bat</i>, if present, or through the <i>Environment Variables</i> option of the <i>Advanced</i> tab of the <i>System</i> area of the Control Panel. Especially when running Apache as a service, you may also want to add the directive</p>
<pre><code> LoadFile "/Path/to/your/Perl/bin/perl5x.dll"</code></pre>
<p>to <i>httpd.conf</i>, before loading <i>mod_perl.so</i>, to load your Perl dll.</p>
<p>You may also want to use a start-up script to load commonly used modules; this can be done with a directive as, eg,</p>
<pre><code> PerlRequire "C:/Apache2/conf/extra.pl"</code></pre>
<p>where a sample start-up script <i>C:/Apache2/conf/extra.pl</i> is</p>
<pre><code> use ModPerl::Util ();
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::RequestUtil ();
use Apache2::ServerRec ();
use Apache2::ServerUtil ();
use Apache2::Connection ();
use Apache2::Log ();
use Apache2::Const -compile => ':common';
use APR::Const -compile => ':common';
use APR::Table ();
use Apache2::compat ();
use ModPerl::Registry ();
use CGI ();
1;</code></pre>
<p><code>Apache2::compat</code> is used to provide backwards compatibility with mod_perl 1.0. <code>ModPerl::Registry</code>, named so as not to conflict with <code>Apache::Registry</code> of mod_perl 1.0, is used for registry scripts.</p>
<h1 id="Registry-scripts">Registry scripts</h1>
<p>Using <code>ModPerl::Registry</code> to speed up cgi scripts may be done as follows. Create a directory, for example, <i>C:/Apache2/perl/</i>, which will hold your scripts, such as</p>
<pre><code> ## printenv -- demo CGI program which just prints its environment
##
use strict;
print "Content-type: text/html\n\n";
print "<HTML><BODY><H3>Environment variables</H3><UL>";
foreach (sort keys %ENV) {
my $val = $ENV{$_};
$val =~ s|\n|\\n|g;
$val =~ s|"|\\"|g;
print "<LI>$_ = \"${val}\"</LI>\n";
}
#sleep(10);
print "</UL></BODY></HTML>";</code></pre>
<p>Note that Apache takes care of using the proper line endings when sending the <i>Content-type</i> header. Next, insert in <i>C:/Apache2/conf/httpd.conf</i> the following directives:</p>
<pre><code> Alias /perl/ "/Apache2/perl/"
<Location /perl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
Options +ExecCGI
PerlOptions +ParseHeaders
</Location></code></pre>
<p>whereby the script would be called as</p>
<pre><code> http://localhost/perl/name_of_script</code></pre>
<p>The <code>PerlOptions +ParseHeaders</code> directive is needed when the script sends the header (in mod_perl 1.0, this was given as <code>PerlSendHeader ON)</code>.</p>
<p>As an illustration of how mod_perl 2.0 addresses the issues raised in the discussion of issues in <a>multithread win32</a> concerning the threading limitations of mod_perl 1.0 on Win32, consider the <code>printenv</code> script above with the <code>sleep(10)</code> line uncommented. Using the Apache benchmarking tool <code>ab</code> of the Apache 2.0 Win32 distribution:</p>
<pre><code> C:\Apache2\bin> ab -n 5 -c 5 http://localhost/perl/printenv</code></pre>
<p>to make 5 concurrent requests, we find the following results. For mod_perl 1.0/Apache 1.3:</p>
<pre><code> Server Software: Apache/1.3.23
Concurrency Level: 5
Time taken for tests: 50.51972 seconds</code></pre>
<p>while for mod_perl 2.0/Apache 2.0:</p>
<pre><code> Server Software: Apache/2.0.45
Concurrency Level: 5
Time taken for tests: 13.729743 seconds</code></pre>
<p>The dramatic difference is due to the fact that in Apache 1.3/mod_perl 1.0 a given request has to finish (taking essentially 10 seconds, due to the <code>sleep(10)</code> call) before the next request is processed, whereas on Apache 2.0/mod_perl 2.0 the requests are processed as they arrive.</p>
<h1 id="Hello-World">Hello World</h1>
<p>As you will discover, there is much to mod_perl beyond simple speed-up of cgi scripts. Here is a simple <i>Hello, World</i> example that illustrates the use of mod_perl as a content handler. Create a file <i>Hello.pm</i> as follows:</p>
<pre><code> package Apache2::Hello;
use strict;
use Apache2::RequestRec (); # for $r->content_type
use Apache2::RequestIO (); # for $r->puts
use Apache2::Const -compile => ':common';
sub handler {
my $r = shift;
my $time = scalar localtime();
my $package = __PACKAGE__;
$r->content_type('text/html');
$r->puts(<<"END");
<HTML><BODY>
<H3>Hello</H3>
Hello from <B>$package</B>! The time is $time.
</BODY></HTML>
END
return Apache2::Const::OK;
}
1;</code></pre>
<p>and save it in, for example, the <i>C:/Perl/site/lib/Apache2/</i> directory. Next put the following directives in <i>C:/Apache2/conf/httpd.conf</i>:</p>
<pre><code> PerlModule Apache2::Hello
<Location /hello>
SetHandler modperl
PerlResponseHandler Apache2::Hello
</Location></code></pre>
<p>With this, calls to</p>
<pre><code> http://localhost/hello</code></pre>
<p>will use <code>Apache2::Hello</code> to deliver the content.</p>
<h1 id="See-Also">See Also</h1>
<p>The directions for <a>installing mod_perl 2.0 on Win32</a>, the <a>mod_perl documentation</a>, <a href="http://perl.apache.org/">http://perl.apache.org/</a>, <a href="http://httpd.apache.org/">http://httpd.apache.org/</a>, <a href="http://www.activestate.com/">http://www.activestate.com/</a>, and the <a>FAQs for mod_perl on Win32</a>. Help is also available through the archives of and subscribing to the <a>mod_perl mailing list</a>.</p>
<h1 id="Maintainers">Maintainers</h1>
<p>Maintainer is the person(s) you should contact with updates, corrections and patches.</p>
<ul>
<li><p>Randy Kobes <randy@theoryx5.uwinnipeg.ca></p>
</li>
</ul>
<h1 id="Authors">Authors</h1>
<ul>
<li><p>Randy Kobes <randy@theoryx5.uwinnipeg.ca></p>
</li>
</ul>
<p>Only the major authors are listed above. For contributors see the Changes file.</p>
</body>
</html>
|