[request] tidy added to the default php extension set?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
[request] tidy added to the default php extension set?
As libtidy is already available in the default packages, would it be a good idea to include the
--with-tidy = shared
option in the default php build? I am not sure about the popularity of the extension, but we used it extensively to validate and clean html entered in input forms.
tidy gets installed as part of kdewebdev, I am not sure why it is bundled in with kdewebdev. Mauricio, with the way tidy is handled currently I don't think it would be a good idea to make php depend on kdewebdev.
I am pretty sure it isn't. Not in Slackware 14 (or earlier). Is it?
By the way, you probably know you can build a PHP extension (like tidy) without rebuilding all of PHP, right?
Thanks for your reply. I am using vanilla Slackware 14, tidy was probably pulled in by my full install, which includes KDE and kdewebdev.
BTW, I tried to build only the tidy extension using PECL. But the latest version available there is 1.2, for PHP4. So it fails (understandably) as it can not find some PHP includes.
After some research (http://devzone.zend.com/241/tidying-...ml-with-php-5/) I learned that, beginning in PHP5.03, Tidy is now bundled as an extension in the PHP5 source tree, so the usual method is to configure and build it with PHP, which is what I am doing now. I am actually building it in a separate work tree and just copying the tidy.so, but in order to do this I have to use the same php config settings used by the official build to make sure the extension will still load.
PHP seems to bundle the tidy source, so perhaps --with-tidy is all it would take.
I'll look into that.
Thanks, Patrick. I think it still needs the system libtidy if you configure --with-tidy = shared (I can see a link to libtidy using ldd), but I am not sure if libtidy can be compiled statically into the extension. But as libtidy is already packaged this might not be an issue.
Tidy itself is not included (bundled) in PHP, neither 5.4.x nor 5.5.x. To build the Tidy extension to PHP, you need the PHP source for the extension (php-<version>/ext/tidy), plus the Tidy source - original source is only available via CVS from sourceforge.net (they do not package up source releases anymore).
You can build the PHP Tidy extension with libtidy compiled as static (libtidy.a, using build/gmake) or shared (libtidy.so).
I did not know about kdewebdev (I don't use it) and that it contains tidy. Thanks for the correction.
You do not need to rebuild PHP to add an extension. There are instructions in README.SELF-CONTAINED-EXTENSIONS within the PHP source distribution. It will be compatible if you follow the steps there. You can just copy the resulting *.so (tidy.so in this case) into the PHP extensions directory, and configure php.ini to load it.
Tidy itself is not included (bundled) in PHP, neither 5.4.x nor 5.5.x. To build the Tidy extension to PHP, you need the PHP source for the extension (php-<version>/ext/tidy), plus the Tidy source - original source is only available via CVS from sourceforge.net (they do not package up source releases anymore).
You can build the PHP Tidy extension with libtidy compiled as static (libtidy.a, using build/gmake) or shared (libtidy.so).
I did not know about kdewebdev (I don't use it) and that it contains tidy. Thanks for the correction.
You do not need to rebuild PHP to add an extension. There are instructions in README.SELF-CONTAINED-EXTENSIONS within the PHP source distribution. It will be compatible if you follow the steps there. You can just copy the resulting *.so (tidy.so in this case) into the PHP extensions directory, and configure php.ini to load it.
If not too much work, would you care to guide me through this process? I just reinstalled Slack64-14 onto my home server and I need the tidy extension... Ive found this thread by searching the web for information!
I think explaining for a begineer like me would be beneficial for everyone.. If not, then I can start a separate thread.
If not too much work, would you care to guide me through this process? I just reinstalled Slack64-14 onto my home server and I need the tidy extension... Ive found this thread by searching the web for information!
I think explaining for a begineer like me would be beneficial for everyone.. If not, then I can start a separate thread.
Thanks!
You need the Tidy library (and header files) installed. If you installed it yourself from source, it will be in /usr/local/... and PHP will find it. If you got it from the Slackware KDE package - I'm not sure, you might have to help configure below find it.
You will need the PHP source package, but you only need to extract the PHP Tidy extension, as shown below. Here are my steps to build the PHP Tidy extension. Don't just type these, since your paths etc may differ. "build" is a temporary, empty directory. This also assumes the "phpize" and "phpconfig" commands are on the PATH, as they are with the Slackware package.
Code:
$ cd build
$ tar -xvjf .../php-5.4.16.tar.bz2 php-5.4.16/ext/tidy
$ cd php-5.4.16/ext/tidy
$ phpize
$ ./configure --with-tidy=shared
$ make
The result is modules/tidy.so which you can either use "make install" as root to install, or just copy it to your PHP extensions directory. Change your php.ini to load it. You probably need something like "apachectl restart" to get it to load, and you are done.
You need the Tidy library (and header files) installed. If you installed it yourself from source, it will be in /usr/local/... and PHP will find it. If you got it from the Slackware KDE package - I'm not sure, you might have to help configure below find it.
Just to confirm that the procedure you mention works flawlessly on my machine. So it is a simple way to get the extension, thanks for documenting it.
The procedure requires the php source tarball, as you mention, which is the only drawback imo. And you probably need to remember to repeat it when php is upgraded on the system, which would be easier if the extension was included in the default set. But this is a minor annoyance.
You need the Tidy library (and header files) installed. If you installed it yourself from source, it will be in /usr/local/... and PHP will find it. If you got it from the Slackware KDE package - I'm not sure, you might have to help configure below find it.
You will need the PHP source package, but you only need to extract the PHP Tidy extension, as shown below. Here are my steps to build the PHP Tidy extension. Don't just type these, since your paths etc may differ. "build" is a temporary, empty directory. This also assumes the "phpize" and "phpconfig" commands are on the PATH, as they are with the Slackware package.
Code:
$ cd build
$ tar -xvjf .../php-5.4.16.tar.bz2 php-5.4.16/ext/tidy
$ cd php-5.4.16/ext/tidy
$ phpize
$ ./configure --with-tidy=shared
$ make
The result is modules/tidy.so which you can either use "make install" as root to install, or just copy it to your PHP extensions directory. Change your php.ini to load it. You probably need something like "apachectl restart" to get it to load, and you are done.
Note this works with other PHP extensions too.
Extremely well explained! Worked like a charm ! Many thanks!!!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.