Installing W3C Markup Validator and Validator Nu on Debian Jessie
Created On: 11 Apr, 2017: 12:28:39 - Tags : website testing
IntroductionW3C Markup Validator and Validator.nu are two useful tools that can be used to validate html code. W3C Markup validator allows validating xhtml, html, xml, mathml and more. Validator.nu allows validating html5 code. The W3C Markup validator is written in perl, while the Validator.nu is written in Java. Both tools are in active development. Both tools provide well documented APIs. The API for W3C Markup Validator is based on soap while the API for Validator.nu is RESTful and can be accessed using HTTP GET or POST methods. Both tools can be accessed online from a web browser or from their respective APIs. If you need to validate several documents then it makes more sense to install the tools locally. By installing the tools locally we can validate documents more quickly and reliably. In this article, I will describe how to install both tools on Debian Jessie.
Installing W3C Markup ValidatorThe W3C Markup Validator can be installed by following the instructions given on the W3C Markup Validation website. The website provides instructions on installing the W3C Markup Validator from a pre built package or from source.
Installing the pre requisitesI tried to install the W3C Markup Validator on Debian Jessie from package but the package was not available in the default repository. I decided to follow these instructions for installing the W3C Markup Validator from source. The installation steps are fairly easy to follow. First you need to install the prerequisites which is the SGML parser called opensp and some perl modules. The install guide mentions installing either several perl modules one by one or installing Bundle-W3C-Validator perl module. I installed the Bundle-W3C-Validator bundle module but I still had to install the perl module: SGML::Parser::OpenSP
Downloading the source codeNext you need to download the source code for the W3C Markup Validator from Github. The W3C Markup Validator requires a web server ideally Apache. The validator source code is written in perl and requires mod_perl Apache module. For me installing mod_perl from source was the most difficult step in the installation.
Installing mod_perlThe Installing mod_perl 2.0 guide describes how to install mod_perl from source. Mod_perl requires perl headers which can be obtained by installing the libperl-dev package using apt-get. After the mod_perl source code has been downloaded, we need to generate the make file using the command: perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs. I got following error when running the command:
Your Perl is configured to link against libgdbm, but libgdbm.so was not found. You could just symlink it to /usr/lib/x86_64-linux-gnu/libgdbm.so.3.0.0I fixed the error by installing the libgdbm-dev package. I ran the command again but got this error:
Reading Makefile.PL args from @ARGV MP_APXS = /usr/local/apache2/bin/apxs no conflicting prior mod_perl version found - good. Using APXS => /usr/local/apache2/bin/apxs [ error] Unable to determine server version, aborting. [ error] Invalid MP_APXS specified?I fixed the error by installing the apxs package using the command apt-get install apache2-dev. The apxs package is a tool for building extensions and modules for apache 2.4. The apxs binary was installed in /usr/bin so I had to update the command to: perl Makefile.PL MP_APXS=/usr/bin/apxs.
After that the package had to be built using make command. After that make test command had to be run for running the package tests. If the tests pass then the mod_perl can be installed using the command make install. The last command copies the mod_perl.so library file to the apache module directory. The module can be enabled using the command a2enmod. During installation of mod_perl the make test command failed with some errors. I decided to post the error to the mod_perl mailing list. After mod_perl was installed, I followed the rest of the installation instructions for the W3C Validator tool. I had to first copy the validator.conf configuration file to /etc/w3c/ folder and then adjust the folder paths in the file.
After that I had to configure a virtual host for the W3C Markup Validator tool. After that I restarted Apache and was able to access the W3C Markup Validator from a browser.