Tidy HTML5 Installation problem with PHP7

February 23, 2017 577 views
Apache PHP Ubuntu

So I am on an Ubuntu server at Digitalocean and I'm trying to install/configure Tidy HTML5 with my current PHP7 Wordpress installation and W3 Total Cache.

However even though I've installed Tidy with the following commands:

    sudo apt-get remove libtidy-0.99-0 tidy -y
    sudo wget -O /tmp/tidy-5.2.0-64bit.deb http://binaries.html-tidy.org/binaries/tidy-5.2.0/tidy-5.2.0-64bit.deb

    sudo dpkg -i /tmp/tidy-5.2.0-64bit.deb

    sudo rm /tmp/tidy-5.2.0-64bit.deb

And it even says that it is at Version 5.2.0, yet it doesn't seem to be loaded/installed.

   rafael@wordpress-staging:~$ php --ini
    Configuration File (php.ini) Path: /etc/php/7.0/cli
    Loaded Configuration File:         /etc/php/7.0/cli/php.ini
    Scan for additional .ini files in: /etc/php/7.0/cli/conf.d
    Additional .ini files parsed:      /etc/php/7.0/cli/conf.d/10-mysqlnd.ini,
    /etc/php/7.0/cli/conf.d/10-opcache.ini,
    /etc/php/7.0/cli/conf.d/10-pdo.ini,
    /etc/php/7.0/cli/conf.d/15-xml.ini,
    /etc/php/7.0/cli/conf.d/20-apcu.ini,
    /etc/php/7.0/cli/conf.d/20-bz2.ini,
    /etc/php/7.0/cli/conf.d/20-calendar.ini,
    /etc/php/7.0/cli/conf.d/20-ctype.ini,
    /etc/php/7.0/cli/conf.d/20-curl.ini,
    /etc/php/7.0/cli/conf.d/20-dom.ini,
    /etc/php/7.0/cli/conf.d/20-exif.ini,
    /etc/php/7.0/cli/conf.d/20-fileinfo.ini,
    /etc/php/7.0/cli/conf.d/20-ftp.ini,
    /etc/php/7.0/cli/conf.d/20-gd.ini,
    /etc/php/7.0/cli/conf.d/20-gettext.ini,
    /etc/php/7.0/cli/conf.d/20-gmp.ini,
    /etc/php/7.0/cli/conf.d/20-iconv.ini,
    /etc/php/7.0/cli/conf.d/20-json.ini,
    /etc/php/7.0/cli/conf.d/20-mbstring.ini,
    /etc/php/7.0/cli/conf.d/20-mysqli.ini,
    /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini,
    /etc/php/7.0/cli/conf.d/20-phar.ini,
    /etc/php/7.0/cli/conf.d/20-posix.ini,
    /etc/php/7.0/cli/conf.d/20-pspell.ini,
    /etc/php/7.0/cli/conf.d/20-readline.ini,
    /etc/php/7.0/cli/conf.d/20-recode.ini,
    /etc/php/7.0/cli/conf.d/20-shmop.ini,
    /etc/php/7.0/cli/conf.d/20-simplexml.ini,
    /etc/php/7.0/cli/conf.d/20-soap.ini,
    /etc/php/7.0/cli/conf.d/20-sockets.ini,
    /etc/php/7.0/cli/conf.d/20-sysvmsg.ini,
    /etc/php/7.0/cli/conf.d/20-sysvsem.ini,
    /etc/php/7.0/cli/conf.d/20-sysvshm.ini,
    /etc/php/7.0/cli/conf.d/20-tokenizer.ini,
    /etc/php/7.0/cli/conf.d/20-wddx.ini,
    /etc/php/7.0/cli/conf.d/20-xmlreader.ini,
    /etc/php/7.0/cli/conf.d/20-xmlrpc.ini,
    /etc/php/7.0/cli/conf.d/20-xmlwriter.ini,
    /etc/php/7.0/cli/conf.d/20-xsl.ini,
    /etc/php/7.0/cli/conf.d/20-zip.ini

    rafael@wordpress-staging:~$ tidy -v
    HTML Tidy for Linux version 5.2.0

Am I missing something here? Or doesn't HTML Tidy work with PHP7? Because I've installed HTML Tidy with the above mentioned commands without any problem on a PHP5.6 installation just fine recently.

Either way thanks for any suggestions or information.

Edit:

I've removed Tidy completely, installed the original from 2009, still not detected, then removed it again and installed the latest version again but yet again it's still not being detected:

    rafael@wordpress-staging:~$ sudo apt-get install tidy
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    tidy is already the newest version (20091223cvs-1.5).
    You might want to run 'apt-get -f install' to correct these:
    The following packages have unmet dependencies:
     tidy : Depends: libtidy-0.99-0 (>= 20091223cvs-1.5) but it is not going to be installed
    E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

    rafael@wordpress-staging:~$ sudo apt-get -f install
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Correcting dependencies... Done
    The following additional packages will be installed:
      libtidy-0.99-0
    The following NEW packages will be installed:
      libtidy-0.99-0
    0 upgraded, 1 newly installed, 0 to remove and 59 not upgraded.
    1 not fully installed or removed.
    Need to get 0 B/120 kB of archives.
    After this operation, 419 kB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    (Reading database ... 120416 files and directories currently installed.)
    Preparing to unpack .../libtidy-0.99-0_20091223cvs-1.5_amd64.deb ...
    Unpacking libtidy-0.99-0 (20091223cvs-1.5) ...
    Setting up libtidy-0.99-0 (20091223cvs-1.5) ...
    Setting up tidy (20091223cvs-1.5) ...
    Processing triggers for libc-bin (2.23-0ubuntu5) ...


    rafael@wordpress-staging:~$ sudo apt-get -y autoremove tidy
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following packages will be REMOVED:
      libtidy-0.99-0 tidy
    0 upgraded, 0 newly installed, 2 to remove and 59 not upgraded.
    After this operation, 505 kB disk space will be freed.
    (Reading database ... 120421 files and directories currently installed.)
    Removing tidy (20091223cvs-1.5) ...
    Removing libtidy-0.99-0 (20091223cvs-1.5) ...
    Processing triggers for man-db (2.7.5-1) ...
    Processing triggers for libc-bin (2.23-0ubuntu5) ...

    rafael@wordpress-staging:~$ sudo wget -O /tmp/tidy-5.2.0-64bit.deb http://binaries.html-tidy.org/binaries/tidy-5.2.0/tidy-5.2.0-64bit.deb
    --2017-02-22 20:15:50--  http://binaries.html-tidy.org/binaries/tidy-5.2.0/tidy-5.2.0-64bit.deb
    Resolving binaries.html-tidy.org (binaries.html-tidy.org)... 151.101.64.133, 151.101.128.133, 151.101.192.133, ...
    Connecting to binaries.html-tidy.org (binaries.html-tidy.org)|151.101.64.133|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 727594 (711K) [application/octet-stream]
    Saving to: ‘/tmp/tidy-5.2.0-64bit.deb’

    /tmp/tidy-5.2.0-64bit.deb     100%[==============================================>] 710.54K  --.-KB/s    in 0.007s

    2017-02-22 20:15:50 (100 MB/s) - ‘/tmp/tidy-5.2.0-64bit.deb’ saved [727594/727594]

    rafael@wordpress-staging:~$ sudo dpkg -i /tmp/tidy-5.2.0-64bit.deb
    Selecting previously unselected package tidy.
    (Reading database ... 120410 files and directories currently installed.)
    Preparing to unpack /tmp/tidy-5.2.0-64bit.deb ...
    Unpacking tidy (5.2.0) ...
    Setting up tidy (5.2.0) ...
    Processing triggers for man-db (2.7.5-1) ...

    rafael@wordpress-staging:~$ sudo rm /tmp/tidy-5.2.0-64bit.deb

    rafael@wordpress-staging:~$ tidy -v
    HTML Tidy for Linux version 5.2.0
    rafael@wordpress-staging:~$ sudo service apache2 restart

Am I really missing something here? Or could someone explain to me what I am doing wrong? Thanks in advance!

1 Answer
jtittle1 February 24, 2017
Accepted Answer

@RafaelDeJongh

Within the default repositories for Ubuntu 16.04.x-16.10.x there's already a package called php7.0-tidy which can be installed to enable HTML Tidy.

To confirm whether this package exists or not:

apt-cache search php7.0-tidy

Then:

apt-get -y install php7.0-tidy

Alternatively, if you'd like to use PHP 7.1.x, you can add that repository using the command below. You'd want to apt-get -y remove php7* before you do the below just to remove any existing 7.0 packages, then you can reinstall after updating.

If you to remove all packages + configuration you can use apt-get -y purge php7.

To add the PHP 7.1 repository:

add-apt-repository -y ppa:ondrej/php

Update/Sync Packages:

apt-get update

Install PHP 7.1:

apt-get -y install php7.1 php7.1-dev php7.1-cli php7.1-tidy ...

Where ... is additional packages that you need and can find by running:

apt-cache search php7.1 --names-only
  • Awesome! Thanks a lot for the great explenation, I didn't even knew or could find that tidy was within the default repo of Ubuntu!

Have another answer? Share your knowledge.