Install Tidy, PHP

39,832

Solution 1

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.

Solution 2

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 libTidy
libTidy 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

Solution 3

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

Solution 4

In ubuntu: you need to run the following command in terminal

sudo apt-get install php5-tidy

and the restart the server

sudo service apache2 restart.

Solution 5

Put that line in php.ini next to the other extension=...dll lines and make sure php_tidy.dll is in the directory configured in php.ini under extension_dir.

Share:
39,832
KyleT
Author by

KyleT

Updated on July 09, 2022

Comments

  • KyleT
    KyleT almost 2 years

    I guess when php was installed on my box --with-tidy arg was not included.

    When browsing my php.ini the line:

    ;extension=php_tidy.dll
    

    is missing.

    How can I add the module to my php install? Note I tried adding:

    extension=php_tidy.dll
    

    but with no luck.

    I checked the docs but all they say is:

    This extension is bundled with PHP 5 and greater, and is installed using the --with-tidy configure option.

  • Matt Parkins
    Matt Parkins about 11 years
    This should work for ubuntu these days: sudo apt-get install php5-tidy
  • polkovnikov.ph
    polkovnikov.ph over 10 years
    Where could one get that php_tidy.dll (except compiling it from source)?
  • Cedric
    Cedric over 10 years
    /*install php5-tidy. Example (for Debian and all:),*/ sudo apt-get install php5-tidy ; /*relaod apache 2*/ : sudo service apache2 reload
  • August Karlstrom
    August Karlstrom over 8 years
    Or with systemd: systemctl restart apache2.
  • Goose
    Goose over 7 years
    I found this answer resulted in errors on the make step.
  • Brian Leishman
    Brian Leishman almost 7 years
    E: Unable to locate package php-tidy EDIT: never mind me, PHP needs to be installed first obviously :)
  • Peter Krauss
    Peter Krauss over 6 years
    The apt was good, work fine, but how to enable? php -i show nothing.
  • Peter Krauss
    Peter Krauss over 6 years
    Hi, the 2017 problem: apt install php7.1-tidy for PHP 7.1... It is not php7.0-tidy (!). The apt and php -i say nothing about that you try to use wrong version.
  • Arnis Juraga
    Arnis Juraga almost 3 years
    For php7 versions, run apt-get install php7.4-tidy and phpenmod tidy