The HTML Tidy Installation Solution

• Views: 1,530

I just spent a couple of hair-pulling hours trying to install HTML Tidy on the LGF web server. Much of that time was spent searching the web for info about installing Tidy, and finding lots of dead ends and instructions that are years out of date. So, in hopes that I can save some poor geek from going through similar torment, here’s the solution I found.

First, DO NOT use the tar file from the SourceForge project’s download page for Tidy: SourceForge.net: Files. Either this file is missing most of what you need to successfully compile Tidy, or there’s some trick I don’t know about. You’ll get a valid gzipped tar file, and it will extract fine. You can even then do a ‘make && make install’ and it will seem to compile and install something. Maybe it’s even useful in that state, somehow.

But it’s worthless for setting up PHP’s Tidy functions, which is why I wanted to install it in the first place.

Instead of the file at SourceForge, use the bzipped tarball at Linux From Scratch, which is generated from a recent version (maybe not the very latest?) in the Tidy CVS repository: HTML Tidy-cvs_20070326. This includes everything you need.

Here’s the exact sequence of commands I used to install the version above, logged in as root. First I created a directory called (oddly enough) ‘tidy’ and cd’ed into it. Then:

wget http://anduin.linuxfromscratch.org/files/BLFS/sources/tidy-cvs_20070326.tar.bz2
bzip2 -d tidy-cvs_20070326.tar.bz2
tar -xvf tidy-cvs_20070326.tar
cd tidy-cvs_20070326
./configure —prefix=/usr
make
make check    # this is optional, to test the compile
make install

(You’ll need to change file and folder names if the version at Linux From Scratch is different from this one.)

That’s it. You now have a fully functional Tidy utility that you can call from the Nixian command line.

To make it work with PHP 4, a couple more steps are necessary.

First, install the PEAR Tidy extension:

pecl install tidy

Second, with Emacs or Vim or whatever editor you like, add the following line to your php.ini file:

extension=tidy.so

Now you can restart Apache:

service httpd restart

…and bada bing. PHP now has a full complement of nice functions for using HTML Tidy to clean up invalid HTML. This will come in handy at LGF for many reasons.

Jump to top

Create a PageThis is the LGF Pages posting bookmarklet. To use it, drag this button to your browser's bookmark bar, and title it 'LGF Pages' (or whatever you like). Then browse to a site you want to post, select some text on the page to use for a quote, click the bookmarklet, and the Pages posting window will appear with the title, text, and any embedded video or audio files already filled in, ready to go.
Or... you can just click this button to open the Pages posting window right away.
Last updated: 2023-04-04 11:11 am PDT
LGF User's Guide RSS Feeds

Help support Little Green Footballs!

Subscribe now for ad-free access!Register and sign in to a free LGF account before subscribing, and your ad-free access will be automatically enabled.

Donate with
PayPal
Cash.app
Recent PagesClick to refresh
Texas County at Center of Border Fight Is Overwhelmed by Migrant Deaths EAGLE PASS, Tex. - The undertaker lighted a cigarette and held it between his latex-gloved fingers as he stood over the bloated body bag lying in the bed of his battered pickup truck. The woman had been fished out ...
Cheechako
4 weeks ago
Views: 448 • Comments: 0 • Rating: 1