On Tue, April 25, 2006 9:43 pm, Crone, James wrote: > I need to add LDAP support to my install of PHP. I had my sysadmin > download OpenLDAP and install the libraries. Our current build of PHP > is complex and I'd prefer not to have to rebuild just to add LDAP. > I've > been told to use the dl() function to load the LDAP library when > needed > in PHP. Whenever I dl("libldap.so") PHP returns the following error: > > PHP Warning: dl(): Invalid library (maybe not a PHP library) > 'libldap.so' in ..... > > What am I doing wrong? Thanks in advance.
libldap.so is the LDAP library -- like, the WHOLE LDAP library, to which PHP has an interface, if you re-compile PHP. So you need to compile (or they need to compile) the PHP LDAP interface down in the ext directory of PHP (or maybe it's in PECL now). This will result in a file with a name something like: ldap_php.so And *that* file is the one you would use dl() on. What you did is kind of like buying an airplane when you need to fly to another city... You needed just the ldap_php.so, and you tried to load in libldap.so, which is a system library. Pretty much all of PHP's extensions work like this. PHP PHP Extensions System Software Libraries PHP Core ----+ +---- mysql_php.so --------> libmysql.so +---- gd_php.so -----------> libgd.so +---- libpdf_php.so -------> libpdf.so . . . That's the basic idea, anyway, even though I'm sure that at least one of the above is actually incorrect, and the names of the libraries and .so files vary a bit, here and there. You only want to dl() the PHP Extension that "bridges" or provides the "glue" to the System Software Library -- You don't want to dl() the whole System Software Library. Replace .so with .dll under Windows, and the same paradigm holds. HTH -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php