Operating System - HP-UX
1752328 Members
5500 Online
108786 Solutions
New Discussion юеВ

Re: Problem with ldap.sl extension for PHP in HPWS22

 
javi00mv
New Member

Problem with ldap.sl extension for PHP in HPWS22

Hello,
I have the next problem,
I am trying to connect to a LDAP(Active Directory) server from PHP using the ldap.sl extension provided in the HPWS distribution of PHP.

The version of HPWS is B3.0, Apache 2.2.8 PHP version 5.2.6. (HPUX 11.23 Itanium64)

I have tested the same code with the same version of PHP running in windows and works perfect.

I have used ldapsearch to test the connection with the ldap server and it works perfect also.

I have made a direct socket connection from php to the server through the 386 port, and works.

But every time that I try to connect to my ldap server through php I receive the same error

Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Unknown error

I think that the problem is a bad configuration of the php extension, as the script works in another system, and ldapsearch too, but I don't know where is exactly the problem.

I have uncommented the appropriate line in the php.ini

extension=ldap.sl

and nothing else, this should be enough following the hpws documentation

┬┐There are any more steps necessary to active this extension?

The code is the following:

echo "Connecting ...".$server.":".$port;
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);

$ds=ldap_connect($server); // must be a valid LDAP server!
print(" Error Code ".ldap_errno($ds)."\n");
echo "connect result is " . $ds . "
";

if ($ds) {
if (ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) {
echo "LDAPv3";
} else {
echo "Erorr setting LDAP version 3";
}
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
echo "Binding ...";

$r=ldap_bind($ds,$user,$password)
or die("Can't bind to server.");

ldap_get_option($ds, LDAP_OPT_ERROR_STRING,$error);
print(" Error Code ".ldap_errno($ds)."\n");
print(" Error Code ".$error."\n");
// read-only access
if ($r) {
echo "Bind result is " . $r . "
";
}
}

Any one has idea about this problem? I would appreciate any help
9 REPLIES 9
Steven E. Protter
Exalted Contributor

Re: Problem with ldap.sl extension for PHP in HPWS22

Shalom,

Isn't that message just special?
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Unknown error


First check the ldap server for any record of communication. That might be helpful in finding the cause.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
javi00mv
New Member

Re: Problem with ldap.sl extension for PHP in HPWS22

Hi Steven,

thanks for your quick response.

that is the message that I receive, the ldap_bind function return a null value.

Unfortunately I can't check the connection in the ldap Server, but if I try with the ldapsearch utility or with the same script from an Apache in a Windows Server it works so the Server is up.

Thanks
javi00mv
New Member

Re: Problem with ldap.sl extension for PHP in HPWS22

Hi Steven,

thanks for your quick response.

that is the message that I receive, the ldap_bind function return a null value.

In the error_log appears these lines :

ldap_create
ldap_err2string

Unfortunately I can't check the connection in the ldap Server, but if I try with the ldapsearch utility or with the same script from an Apache in a Windows Server it works so the Server is up.


Thanks
javi00mv
New Member

Re: Problem with ldap.sl extension for PHP in HPWS22

I have some news,

I had activated two extesions
oci8.sl and ldap.sl, deactivating the first extension the error(oci) the output change and now i get this error in the error log:

Unsatisfied code symbol 'ldap_bind_s' in load module

Some idea?
Shinji Teragaito_1
Respected Contributor

Re: Problem with ldap.sl extension for PHP in HPWS22

You should report this symptom to our Response Center if you have
your service contract. I think the symtom is a defect for Apache
2.2.8.

I was able to reproduce your symptom on 11.23 with Apache
B.2.2.8.01 (HP WSS v3.01) or B.2.2.8.02 (HP WSS v3.02). But I can
not encounter the problem on Apache B.2.0.58.01 (very old
WSS :-).

It seems to me the symbol 'ldap_bind' is undefined in B.2.2.8.

# nm /opt/hpws22/apache/modules/mod_ldap.so | grep ldap_bind
#
# nm /opt/hpws22/apache/php/lib/php/extensions/ldap.sl | grep ldap_bind
[183] | 0| 0|FUNC |GLOB |0| UNDEF|ldap_bind_s
[148] | 4611686018427410144| 912|FUNC |GLOB |0| .text|zif_ldap_bind
#

On the other hand, Apache 2.0.x has it:

# nm /opt/hpws/apache/modules/mod_ldap.so | grep ldap_bind
[3761] | 4611686018428770944| 224|FUNC |GLOB |0| .text|ldap_bind
[4607] | 4611686018428771200| 240|FUNC |GLOB |0| .text|ldap_bind_s
#
# nm /opt/hpws/apache/php/lib/php/extensions/ldap.sl | grep ldap_bind
[710] | 4611686018427572544| 224|FUNC |GLOB |0| .text|ldap_bind
[877] | 4611686018427572832| 240|FUNC |GLOB |0| .text|ldap_bind_s
[701] | 4611686018427511552| 512|FUNC |GLOB |0| .text|zif_ldap_bind
#

Shinji
Dennis Handly
Acclaimed Contributor

Re: Problem with ldap.sl extension for PHP in HPWS22

>It seems to me the symbol ldap_bind is undefined in B.2.2.8.
> nm /opt/hpws22/apache/modules/mod_ldap.so | grep ldap_bind

The proper command for shlibs is "elfdump -n .dynsym -s", not nm. This handles the case of striped shlibs.
Shinji Teragaito_1
Respected Contributor

Re: Problem with ldap.sl extension for PHP in HPWS22

Sorry for your inconvenience.

I discussed this symptom with the lab. The lab built a new ldap.sl
for Apache 2.2.8. I confirmed the new ldap.sl works correctly. Now
this defect was filed as QXCR1000920656. I asked the lab the next WSS
release version provide the new ldap.sl.

Shinji
javi00mv
New Member

Re: Problem with ldap.sl extension for PHP in HPWS22

Ok Shinji, thanks for all your efforts,

so as i anderstand this is a bug in the ldap.sl of this Apache version, that will be solved in a future HPWS version, isn't it?

In this case i will try to use another strategy to solve my actual problem and i will try again in the future.
Shinji Teragaito_1
Respected Contributor

Re: Problem with ldap.sl extension for PHP in HPWS22

Your understanding is correct.