how to know when a php library is installed
| From: | Lizet Pena de Sola | Date: | Sun, 21 Aug 2005 06:37:48 +0000 |
| Subject: | how to know when a php library is installed | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-221029@lists.php.net to get a copy of this message | ||
Hello all:
I need to test whether a library is installed with php or not. In this
case it's the tidy library I need for a project.
After getting a message from the hosting administrator that the tidy
library was installed and ready to use I ran a phpinfo() to find out
details:
There's nothing that looks like tidy in the Configure Command:
Configure Command './configure' 'i386-redhat-linux'
'--prefix=/usr'
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin'
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include'
'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var'
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--prefix=/usr'
'--cache-file=../config.cache' '--with-config-file-path=/etc'
'--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect'
'--disable-debug' '--enable-pic' '--disable-rpath'
'--enable-inline-optimization' '--with-bz2' '--with-db3'
'--with-curl'
'--with-pear' '--with-dom=/usr' '--with-exec-dir=/usr/bin'
'--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd'
'--enable-gd-native-ttf' '--with-ttf' '--with-gdbm'
'--with-gettext'
'--with-ncurses' '--with-gmp' '--with-iconv'
'--with-jpeg-dir=/usr'
'--with-openssl' '--with-png' '--with-pspell'
'--with-regex=system'
'--with-xml' '--with-expat-dir=/usr' '--with-pcre=/usr'
'--with-zlib'
'--with-layout=GNU' '--enable-bcmath' '--enable-exif'
'--enable-ftp'
'--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets'
'--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path'
'--enable-track-vars' '--enable-trans-sid' '--enable-yp'
'--enable-wddx' '--without-oci8' '--with-pear=/usr/share/pear'
'--with-imap=shared' '--with-imap-ssl' '--with-kerberos'
'--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql'
'--with-snmp=shared,/usr' '--with-snmp=shared'
'--enable-ucd-snmp-hack' '--with-unixODBC=shared'
'--enable-memory-limit' '--enable-bcmath' '--enable-shmop'
'--enable-versioning' '--enable-calendar' '--enable-dbx'
'--enable-dio' '--enable-mcal' '--enable-mbstring'
'--enable-mbstr-enc-trans' '--enable-mbregex' '--enable-cgi'
However there is a section in the phpinfo output that shows:
tidy
Tidy support enabled
libTidy Build Date 1 July 2005
Directive Local Value Master Value
tidy.default_config no value no value
Tidy Configuration Directive Value
indent-spaces 0
....
I've tried to run this php code to call tidy functions:
<?
$html = '
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en" lang="en">
<head><title>title</title></head>
<body>
<p>paragraph <bt />
text</p>
</body></html>
';
$tidy = new tidy;
$tidy->parseString($html);
$tidy->CleanRepair();
if ($tidy->errorBuffer) {
echo "The following errors were detected:\n";
echo $tidy->errorBuffer;
}
?>
And always get the error cannot instantiate nonexistent class.
Any input, comments are more than welcome,
Lizet