Categorized | News, PHP

Installing Tidy on PHP 4 and 5

Posted on 04 October 2005 by Demian Turner

If you’re like me, you need to run both PHP4 and PHP5 on the same computer, at the same time. If you’re installing PHP from source, this is pretty easy, as you can use the "–prefix" option to install each version into a different location. So, for example, I install PHP4 into /usr/local/php4, and PHP5 into /usr/local/php5.

However, I recently had problems with getting tidy to work with this setup. With Demian’s help, however, I have the answer:

  1. Download the libtidy source (tidy_src.tar.gz) from http://tidy.sourceforge.net/.
  2. Put it into /usr/local/src (for example), and untar.
  3. Go into the untarred library’s /build/gmake/ directory.
  4. Run ‘gmake’, and ‘gmake install’.
  5. Check that ‘/usr/local/lib/libtidy.a’ exists. This is the default install for libtidy.

Now, you need to install tidy for each version of PHP. For PHP4:

  1. Recompile and install PHP4 using the ‘–with-tidy=/usr/local’ option.
  2. Download the PECL tidy source from http://pecl.php.net/package/tidy. At present, you want version 1.1.
  3. Put it into /usr/local/src (for example), and untar.
  4. Run ‘phpize’ – ensure you use the PHP4 version of phpize, so, /usr/local/php4/bin/phpize, for example.
  5. Run ‘./configure; make; make install’.
  6. The extension (tidy.so) will have been placed in /usr/local/lib/php/extensions/no-debug-non-zts-20020429/. If, like me, you have installed PHP4 elsewhere, you will need to move the file to the corresponding location in your real PHP4 install (e.g. /usr/local/php4/lib/php/extensions/no-debug-non-zts-20020429/).
  7. Add ‘extension=tidy.so’ to your PHP4’s php.ini file.

The installation of tidy for PHP5 is much easier:

  1. Recompile and install PHP5 using the ‘–with-tidy=/usr/local’ option.

Bookmark and Share

6 Comments For This Post

  1. YoGi Says:

    Easier with FreeBSD and the ports system ( http://www.freebsd.org/cgi/ports.cgi?query=php5-tidy&stype=all ).

    $ cd /usr/ports/www/php5-tidy
    $ make
    $ make install

    and you’re done.

    btw, i don’t think you have to recompile PHP5 to add an extension.

  2. Espen Holje's blogg Says:

    http://www.phpkitchen.com/index.php?/archives/727-Installing-Tidy-on-PHP-4-and-5.html 
    |  Comments
    If you’re like me, you need to run both PHP4 and PHP5 on the same computer,
    at the same time. If you’re installing PHP from source, this is pretty ea

  3. Demian Turner Says:

    I’ve come to believe almost all the linux distros are better suited for installing software then red hat, most certainly debian and freebsd.

  4. Dennis Says:

    If you’re like me, you need to run both PHP4 and PHP5 on the same computer, at the same time.

  5. Stefan Says:

    Hello,

    does anybody know if it’s possible to run tidy on php4.3.11 on a windows system. this with apache2. I cant get it to work. I think wrong dll but there is no place to download the right one..

    I would be very happy if someone could help me out..

    Thanks in advance.

    Stefan

  6. Pascal Van Hecke Says:

    Hi,

    I have the following problem:

    I am trying tidy with php5 running in cgi-wrap, as indicated by this article on pair support.

    http://www.pair.com/support/knowledge_base/authoring_development/system_cgi_php-cgiwrap.html

    PHP5 runs fine this way, but the executable is not compiled with tidy (tidy isn’t mentioned when I run phpinfo()).

    Is there a way to get tidy included still?
    I tried

    php_value tidy.default_config /usr/..path../tidy/

    in .htaccess , but that didn’t work.
    Thanx in advance!

1 Trackbacks For This Post

  1. 给AndLinux下面的xampp装tidy模块的经验 | 程序如此灵动! Says:

    […] 一、准备工作 这里的准备工作,是多次失败,多次试验的结果,和网上说流行的说法还是不一样。主要参考了一个英国程序员的文章。见这里:http://phpkitchen.com/2005/10/installing-tidy-on-php-4-and-5/ 当然我的安装过程中和他的不是太一样。大家可以去看看他的文章。 1.下载tidy的cvs版本。 :pserver:anonymous@tidy.cvs.sourceforge.net:/cvsroot/tidy 当然如何使用cvs并不是本文讨论的内容。 2.配置andlinux Sudo Apt-get intall autoconf ln -sf /usr/bin/make /usr/bin/gmake 这2步目前没有什么用途,但是在安装过程中就会遇到这个问题。 3.下载xampp的dev包 http://www.apachefriends.org/en/xampp-linux.html   […]

Leave a Reply

Categories

Books

Demian Turner's currently-reading book recommendations, reviews, favorite quotes, book clubs, book trivia, book lists

Facebook