summaryrefslogtreecommitdiffstats
path: root/htdocs/docs/install_win.html
blob: 10fe5db9847585f05556ae93808aebc085495720 (plain)
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
<!--#set var="title" value="Installation Documentation for The W3C Markup Validation Service (Windows, Apache)" 
--><!--#set var="relroot" value="../" 
--><!--#include virtual="../header.html" -->
<div class="doc">
<h2>Installing the W3C-Validator on a Apache under Windows</h2>

<h3 id="TableOfContents">Table of Contents</h3>
<div id="toc">
  <ul>
    <li><a href="#about">About this guide</a></li>
    <li><a href="#needed-programs">Needed programs and other prerequisites</a></li>
    <li><a href="#directory-structure">Directory Structure</a></li>
    <li><a href="#install-programs">Installation of the Programs</a></li>
    <li><a href="#modules">Integration of the Perl Modules</a></li>
    <li><a href="#config-apache">Configuration of the Apache Web server</a></li>
    <li><a href="#adaption-of-hosts">Adaptation of the hosts-File</a></li>
    <li><a href="#config-validator">Configuration of the Validator</a></li>
    <li><a href="#adaption-of-check">Adaptation of the check-Script</a></li>
    <li><a href="#hints">Hints</a></li>
  </ul>
</div>

<div id="install" class="stb">
<h3 id="about">About this guide</h3>

<p>This guide for the installation of the W3C Markup Validator was
contributed by David Tibbe. It is also available 
<a href="http://aktuell.de.selfhtml.org/artikel/server/validator/">in german</a>.</p>

<p>See the <a href="install.html">generic installation guide</a> for instructions on how
to install the Markup Validator on other platforms and <a href="install.html#otherguides">links
to other platform-specific guides</a>.</p>

<h3 id="needed-programs">Needed programs and other prerequisites</h3>
<p>The first prerequisite to run the validator on your system is a Web server. 
  This guide will assume that the server is already installed, and its configuration
  will not be discussed here. The server used in this guide is 
  <a href="http://httpd.apache.org/">Apache</a> 2, and the instructions should be applicable
  to most versions of Apache.</p>
  
<p>The Markup Validator itself is basically a script written in Perl, so you will
  need that, too. <a href="http://www.activestate.com/Products/ActivePerl/">ActivePerl</a> (version 5.8),
  is one of the options, and thanks to its installer should not be difficult to set up.</p>
  
<p>Of course, you will also need the Validator itself. It is available for 
 <a href="http://validator.w3.org/source/">download</a> as two tar-archives:
 the <a href="http://validator.w3.org/validator.tar.gz">validator itself</a>
  (~300kB), and a <a href="http://validator.w3.org/sgml-lib.tar.gz">collection of 
  <acronym title="Document Type Definition">DTDs</acronym></a>
  (~400kB).</p> 
  

<p>The validator relies on a number of Perl libraries, or "modules". 
At <a href="http://ppm.activestate.com/">Active State</a>,
  has a list of all available modules for Active Perl. In this list is also mentioned
  if a module is &quot;Core&quot; (which means it is build in) or if it
  is downloadable.<br />
  For the validator, the following modules are required:</p>
<ul>
  <li>Class-Accessor</li>
  <li>Config-General</li>
  <li>Encode-HanExtra</li>
  <li>HTML-Encoding</li>
  <li>HTML-Parser</li>
  <li>HTML-Template</li>
  <li>JSON</li>
  <li>Net-IP</li>
  <li>SGML-Parser-OpenSP</li>
  <li>XML-LibXML</li>
  <li>XML-NamespaceSupport</li>
  <li>XML-SAX</li>
  <li>XML-LibXML-Common</li>
</ul>
<p>...and the following are optional:</p>
<ul>
  <li>Encode-JIS2K</li>
  <li>HTML-Tidy</li>
</ul>
<p>You can get each of them in a single package at ActiveState. They are also 
  packed  ready-to-install <a href="http://www.myhpi.de/~dtibbe/download/ppm.zip">in a single zip-file</a>,
  (courtesy of the guide's author).</p>

<p>Finally you will need some calm and patience. A whole installation of
  the validator (including the Apache and Perl) will take about an hour 
  if you do not have much experience.</p>
  
<h3 id="directory-structure">Directory Structure</h3>
<p>It might be a good idea to think about the directories the program should be
  installed to. Just clicking &quot;Next&quot; in all installation routines is not a very good idea.</p>

<p>One suggested method is to  have a directory <code>C:\www</code> in which all programs concerning the
  Web server are located (in subfolders, obviously). For instance, Apache is installed in
  <code>C:\www\Apache2</code>, Perl in <code>C:\www\perl</code>, the Perl modules unzipped in
  <code>C:\www\pmm</code>, the validator itself in <code>C:\www\validator</code> and finally
  the DTD-Collection in <code>C:\www\sgml-lib</code></p>

<p>The rest of this guide will assume that these paths are being used. If you want to use another 
directory structure, you will have to adapt the instructions and sample configuration to your
own setup.</p>

<h3 id="install-programs">Installation of the Programs</h3>
<p>Next, you will be installing all the programs and libraries one after the other.</p>

<p>The Apache Web server
  should first be installed and successfully started. As mentioned, this will not be
  explained in here, but you will find a lot of How-Tos all over the net, e.g.
  in the <a href="http://httpd.apache.org/docs/2.2/platform/windows.html">Documentation on the Apache site</a>
  The only thing that is important to know is that the installation
  routine will create a subfolder <code>Apache2</code> by itself. Therefore, you will want to choose
  <code>C:\www</code> as installation directory, and Apache will be installed to
  <code>C:\www\Apache2</code>.</p>
    
<h3 id="modules">Adding the Perl Modules</h3>
<p>Since Perl 5.8.8 build 817.91 PPM has a <acronym title="Graphical User Interface">GUI</acronym>.
  It is quite easy to use, if you do have any problems have a look at its documentation.</p>
<p>You can add the modules from the downloaded package or directly from the web. If you want
   to install them from a local repository, you have to add it first (if you don't want to do so,
   just skip this step).</p>
<p>That can be done within in the preferences dialogue (Edit -&gt; Preferences -&gt;
  Repositories). Click the Folder-Icon, select C:\www\ppm and name the repository
  &quot;Local&quot;, for example. Click &quot;Add&quot; and then &quot;OK&quot;.</p>
<p>When you type the first letters of the desired package, the long list is getting
  shorter and only matching packages are shown. Select the one you want to install,
  select &quot;Install...&quot; from the context menu. When you have done that for
  all packages, click the little green arrow in the to of the window.</p>
<p>In the little status window on the bottom you will see the progress and success
  of each installation. Exit PPM when all packages have been installed.</p>
  
<h3 id="config-apache">Configuration of the Apache Web server</h3>
<p>The first file to edit is the <code>httpd.conf</code> located at 
  <code>C:\www\Apache2\conf</code>, the central configuration file 
  of your Apache. It is recommended to make a backup before editing
  it.</p>
<p>The validator pages are composed by using 
  <acronym title="Server Side Include">SSI</acronym>. Therefore, the 
  Apache has to load the required module. In
  &quot;Section&nbsp;1&nbsp;Global&nbsp;Environment&quot;, the different
  modules are loaded. SSI needs <code>mod_include</code> for working.
  The line</p>
<pre>
LoadModule include_module modules/mod_include.so
</pre>
<p>has to be unquoted (by deleting the # at the beginning of the line) or added
  completely if the module is not loaded yet.</p>
<p>The next step is to create a virtual host. It is needed, because the validator
  should be run from a different directory and logically separated from the
  default host. At the end of the <code>httpd.conf</code>, in 
  &quot;Section&nbsp;3:&nbsp;Virtual&nbsp;Hosts&quot;, the following lines have to be added:</p>
<pre>
NameVirtualHost 127.0.0.2:80

&lt;VirtualHost 127.0.0.2:80&gt;
    ServerName validator.example.org
    DocumentRoot &quot;C:/www/validator/htdocs&quot;

    ErrorLog logs/error_validator.log
    CustomLog logs/access_validator.log common

    ScriptAlias /cgi-bin &quot;C:/www/validator/httpd/cgi-bin&quot;
    ScriptAlias /check &quot;C:/www/validator/httpd/cgi-bin/check&quot;

    AddType text/html .html
    AddOutputFilter INCLUDES .html

    &lt;Directory &quot;C:/www/validator/htdocs&quot;&gt;
        Options ExecCGI Includes Indexes MultiViews
        AddEncoding x-gzip .gz
        &lt;Files *.js.gz&gt;
            ForceType application/javascript
        &lt;/Files&gt;
        &lt;Files *.css.gz&gt;
            ForceType text/css
        &lt;/Files&gt;
        AllowOverride None
        Order deny,allow
        Allow from localhost
    &lt;/Directory&gt;
    
    &lt;Directory &quot;C:/www/validator/httpd/cgi-bin&quot;&gt;
        Options ExecCGI Includes Indexes MultiViews
        AllowOverride None
        Order deny,allow
        Allow from localhost
    &lt;/Directory&gt;
    
&lt;/VirtualHost&gt;
</pre>
<p>It may be that the <code>httpd.conf</code> is splitted into more than one
  file. The other files will be located in the <code>C:\www\Apache2\conf\extra</code>
  folder. If there is a file named <code>httpd-vhosts.conf</code> edit this one and
  make sure that it will be included in the <code>httpd.con</code> (there must be
  a line</p>
<pre>
# Local access to the Apache HTTP Server Manual
Include conf/extra/httpd-manual.conf
</pre>
<p>The meaning of all these lines will not be discussed here. Who is
  interested in their sense can have a look to the manual or in one
  of the many How-Tos found by Google. Just some short notes about:
  The first line specifies the IP-address, the validator should run
  at. It is a loop back address, so the validator will be accessible
  only from your machine. The following lines specify the name of
  the host, the locations of the log files and some &quot;short
  cuts&quot; for the cgi-bin directory and check-script. The next 
  three lines make the Apache parsing HTML-files for SSI-directives.
  The last two sections set some permission for the used
  directories.<br />
  The files <code>error_validator.log</code> and
  <code>access_validator.log</code> can be found in the 
  <code>C:\www\Apache2\logs</code>-directory. They log every 
  request and error occurring on this host and give you some 
  helpful advices in these cases.</p>
<p>Finally, the Apache has to be restarted so that the changes
  take effect. You can do that by choosing the shortcut in the 
  Apache-program group (<kbd>Start</kbd>, <kbd>Programs</kbd>,
  <kbd>Apache HTTP Server</kbd>, <kbd>Control Apache Server</kbd>
  <kbd>Restart</kbd>). A DOS-box will appear shortly;
  when it disappears, the Apache is restarted.</p>
<p>When you call http://127.0.0.2/ in your browser, you should 
  see the well-known site from 
  <a href="http://validator.w3.org/">http://validator.w3.org/</a>.
  In the configuration file of the Apache, a name for the Virtual
  Host was defined (validator.example.org), but it is not 
  resolved yet. That is changed in the next step.</p>

<h3 id="adaption-of-hosts">Adaptation of the hosts-File</h3>
<p>The <code>hosts</code>-file can be seen as a local
  DNS-configuration. It is located in at
  <code>C:\windows\hosts</code> on Win9x and at
  <code>C:\Windows\system32\drivers\etc\hosts</code> on
  WinXP. It might be possible, that the file is missing,
  but a file <code>hosts.sam</code> can be found instead.
  In that case you have to rename it by deleting the file
  extension and its leading dot.</p>
<p>When opening it in an editor, you will find a leading 
  comment in there. A line</p>
<pre>
127.0.0.1 localhost
</pre>
<p>follows.</p>
<p>That line means that a request to localhost is redirected
  to 127.0.0.1 (i.e. calling http://localhost/ in your browser
  effects a request to http://127.0.01/).</p>
<p>Edit the file to the following:</p>
<pre>
127.0.0.1 localhost
127.0.0.1 www.example.org
127.0.0.2 validator.example.org
</pre>
<p>After these changes, the server is available at 
  http://localhost/ but can be accessed also at 
  http://www.example.org/, too. Requests for 
  http://validator.example.org/ are redirected to 
  http://127.0.0.2/.</p>
<p>The server configuration is finished right now. But if you 
  try to validate a page, you will get an &quot;Internal Server Error&quot;,
  because the <code>check</code>-script has not been configured yet.</p>

<h3 id="config-validator">Configuration of the Validator</h3>
<p>In the directory <code>c:\www\validator\htdocs\config</code>, a file 
  called <code>validator.conf</code> can be found. Open it with the editor.
  Lines beginning with # are comments.</p>
<p>For the SGML <code>Library</code>, <code>c:/www/sgml-lib</code>
  is declared. Notice that slashes are used here instead of 
  windows-like back slashes.</p>

<p>The last option that has to be modified is Allow Private 
  <code>IPs = { no | yes }</code>. It must be set to
  &quot;yes&quot;. Otherwise, you cannot validate files 
  from the local PC and you will get just an access fault
  because of security reasons.</p>
<p>After that, the configuration file will look like this:</p>
<pre>#
# Main Configuration File for the W3C Markup Validation Service.
#
# See 'perldoc Config::General' for the syntax, and be aware that the
# 'SplitPolicy' is 'equalsign', ie. keys and values are separated by '\s*=\s*',
# and that 'InterPolateVars' is in effect.
#

#
# Base Path for Markup Validator files.
#
# You MUST set these unless you use the default locations for the files.
# e.g. the config files in &quot;/etc/w3c/&quot; and everything else in
# &quot;/usr/local/validator/&quot;.
#
# Make sure all file paths below do NOT end with a slash

&lt;Paths&gt;
  #
  # Base path.  Defaults to the value of the W3C_VALIDATOR_HOME environment
  # variable or /usr/local/validator if the variable does not exist.
  #Base = /usr/local/validator

  #
  # Location of template files
  Templates = $Base/share/templates

  # configuration file for HTML::Tidy Module, if available
  TidyConf = $Base/htdocs/config/tidy.conf

  &lt;SGML&gt;
    #
    # The SGML Library Path.
    Library = C:/www/sgml-lib
  &lt;/SGML&gt;
&lt;/Paths&gt;

#
# This controls whether the debugging options are allowed to be enabled. 
Allow Debug = yes

#
# This lets you permanently enable the debugging options. Can be overridden
# with CGI options (unlike &quot;Allow Debug&quot; above).
Enable Debug = no

#
# Whether private RFC1918 addresses are allowed.
Allow Private IPs = yes

#
# Enable (or not) the web service API for this validator
# see http://validator.w3.org/docs/api.html
Enable SOAP = yes


#
# Whether the validator will check its own output.
# 0 means it will refuse to check its own output, 1 means it will but it will
# refuse to check the results of it checking itself. Etc.
Max Recursion = 0

#
# Protocols the validator is allowed to use for retrieving documents.
# The default is to allow http and https.
&lt;Protocols&gt;
  Allow = data,http,https
&lt;/Protocols&gt;

#
# Email address of the maintainer of this service.
Maintainer = www-validator@w3.org

# Localization
# only English available for now
Languages = en



#
# Mapping tables etc...
#

#
# Main document Type Registry; contains all information on the types
# of documents we support and how they are processed.
&lt;Types&gt;
  Include types.conf
&lt;/Types&gt;

#
# Mapping of charset names to their IANA names and how iconv(3) knows them.
&lt;Charsets&gt;
  Include charset.cfg
&lt;/Charsets&gt;

#
# Map MIME Media Type to Parse Mode mapping.
&lt;MIME&gt;
  text/xml              = XML
  image/svg             = XML
  image/svg+xml         = XML
  application/smil      = XML
  application/xml       = XML
  text/html             = TBD
  text/vnd.wap.wml      = XML
  application/xhtml+xml = XML
  application/mathml+xml = XML
&lt;/MIME&gt;
</pre>
<p>Now, the validator has been successfully configured. But it
  is not ready for use yet, some lines in the validator script
  itself have to be changed before.</p>

<h3 id="adaption-of-check">Adaptation of the check-Script</h3>
<p>The following changes are necessary because the script is 
  written for a Unixserver where some things are different to
  a Windows-system.</p>
<p>The <code>check</code>-script located in the directory 
  <code>C:\www\validator\httpd\cgi-bin</code> can be opened
  with the editor. I will not mention any line numbers in 
  the following steps, because they might differ in
  later versions. Some advices are always placed in the lines above
  in the script so that you can orientate yourself to those lines.</p>
<p>The very first line of the script has to be changed to</p>
<pre>
#!c:/www/perl/bin/perl.exe
</pre>
<p>This is the path to the Perl interpreter, up to now in
  Unix-style. So it has to be changed to Windows-style. The
  parameter <code>-T</code> is replaced by that, too.</p>
<p>In the following lines the script is told where to find the 
  configuration file. That is done after the comment in these lines</p>
<pre>
#
# Read Config Files.
eval {
  my %config_opts = (
     -ConfigFile =&gt; ($ENV{W3C_VALIDATOR_CFG} || '/etc/w3c/validator.conf'),
</pre>
<p>We do not define an environment variable but specify the full path
  to the file. So the lines have to be changed to</p>
<pre>
#
# Read Config Files.
eval {
  my %config_opts = (
     -ConfigFile =&gt; 'C:/www/validator/htdocs/config/validator.conf',
</pre>     
<p>For some configurations, the check-skript needs to know where
  its root directory is. It tries to read it from the environment
  variable W3C_VALIDATOR_HOME and uses a default directory if it is
  not set. That is done within the line:</p>
<pre>
          Paths => {
            Base => ($ENV{W3C_VALIDATOR_HOME} || '/usr/local/validator'),
          },
</pre>
<p>So we change that line fixed to our path:</p>
<pre>
          Paths => {
            Base => 'C:/www/validator',
          },
</pre>.

<p>After saving the script, you can use it at http://validator.example.org/
  as you know it from http://validator.w3.org/.</p>
<p>That is it, your own validator is working.</p>

<h3 id="hints">Hints</h3>
<p>In further versions of the validator, some other Perl modules
  will be needed perhaps. They can be downloaded by PPM. You 
  can discover that case very easily: When trying to run the script,
  you will get an output like</p>
<pre>
Can't locate Config/General.pm in @INC (@INC contains: C:/www/perl/lib C:/www/perl/site/lib .)
    at C:/www/validator/httpd/cgi-bin/check line 46.
BEGIN failed--compilation aborted at C:/www/validator/httpd/cgi-bin/check line 46.
</pre>  
<p>It is easy to see that the missing module is &quot;Config General&quot;,
  that has to be installed.</p>
<p>Windows XP with Service Pack 2 installed might have problems with the
  loop back address 127.0.0.2. The Problem and its solution are 
  described at <a href="http://support.microsoft.com/default.aspx?kbid=884020">http://support.microsoft.com/default.aspx?kbid=884020</a>.</p>
<p>If you do have any further questions or suggestions to improve this guide,
 you can use our <a href="../feedback.html">feedback</a> channels.</p>
</div>
</div>
<!--#include virtual="../footer.html" -->
  </body>
</html>