Install Tidy, PHP Install Tidy, PHP php php

Install Tidy, PHP


On Ubuntu, you can add tidy to your php5 installation by running this command in a terminal:

$ sudo apt-get install php5-tidy

If you want to check if it is already installed or validate that the command above worked:

$ php -i | grep libTidylibTidy Release => 25 March 2009 // means tidy is installed

To install both php5 and tidy at the same time, use this command (as an alternative to the "--with-tidy" configuration option):

$ sudo apt-get install php5 php5-tidy


For PHP 7 just run

sudo apt-get install php-tidy

And restart Apache, That's it :)


Update: Thanks to @Arnis Juraga

For the version above PHP 7, you can mention the version code as follows.
apt-get install php7.4-tidy


I was having the same trouble, and wrote up my solution here:
Installing Tidy 2.0 PHP extension on Ubuntu 10.10
http://web.onassar.com/blog/2010/11/16/installing-tidy-2-0-php-extension-on-ubuntu-10-10/

It works on newer versions of Ubuntu as well.
While it may not be the most direct route, it works well.
I hope it helps others.