php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18659 can not bind a ldap server via function ldap_bind()
Submitted: 2002-07-31 03:26 UTC Modified: 2002-07-31 04:24 UTC
From: lesson at 263 dot net Assigned:
Status: Not a bug Package: LDAP related
PHP Version: 4.2.2 OS: Red had 7.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lesson at 263 dot net
New email:
PHP Version: OS:

 

 [2002-07-31 03:26 UTC] lesson at 263 dot net
    I have got a problem when bind to a ldap server

software:
apache_1.3.26
php-4.2.2
openldap-2.1.3
mysql-3.23.51
install:
[mysql] 
          ./configure --prefix=/usr/local/mysql
          make
          make install
[openldap]
          env CPPFLAGS=-I/usr/local/BerkeleyDB.4.0/include LDFLAGS=-L/usr/local/BerkeleyDB.4.0/lib ./configure
          make
          make install
[php]
          cd ../apache_1.3.26
          ./configure
          cd ../php-4.2.2
          ./configure --with-mysql --with-ldap --with-apache=../apache_1.3.26
          make
          make install
[apache]  ./configure --prefix=/usr/local/apache  --activate-module=src/modules/php4/libphp4.a
          make
          make install
No errors report while install.
here is my test program
<?php
echo "<h3>LDAP query test</h3>";
echo "Connecting ...";
$ds=ldap_connect("localhost");  
echo "connect result is ".$ds."<p>";

if ($ds) {
    echo "Binding ...";
    $r=ldap_bind_s($ds);     // this is an "anonymous" bind, typically
                           // read-only access
    echo "Bind result is ".$r."<p>";
?> 
and I got a error message below:
Warning: LDAP: Unable to bind to server: Protocol error in /home/httpd/html/test.php

any idea?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-31 04:24 UTC] hholzgra@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.
 [2002-09-05 20:04 UTC] davidkoopman at yahoo dot com
I am trying to fix my 4.2.2 version of PHP so it will work with openldap-2.1.4.  The ldap_bind function will not work out of the box.  ldap.c needs to be modified to work with version 3.

When I try to bind, I get:
ldap_bind():  Unable to bind to server

When running slapd in debug mode, here is output from it:
do_bind: version=2 dn="cn=Manager,dc=example,dc=com" method=128
send_ldap_result: conn=0 op=0 p=2
send_ldap_response: msgid=1 tag=97 err=2
ber_flush: 52 bytes to sd 12
  0000:  30 32 02 01 01 61 2d 0a  01 02 04 00 04 26 72 65   02...a-......&re
  0010:  71 75 65 73 74 65 64 20  70 72 6f 74 6f 63 6f 6c   quested protocol
  0020:  20 76 65 72 73 69 6f 6e  20 6e 6f 74 20 61 6c 6c    version not all
  0030:  6f 77 65 64                                        owed
ldap_write: want=52, written=52
  0000:  30 32 02 01 01 61 2d 0a  01 02 04 00 04 26 72 65   02...a-......&re
  0010:  71 75 65 73 74 65 64 20  70 72 6f 74 6f 63 6f 6c   quested protocol
  0020:  20 76 65 72 73 69 6f 6e  20 6e 6f 74 20 61 6c 6c    version not all
  0030:  6f 77 65 64                                        owed


NOTICE the "version not allowed" comments coming from slapd.
 [2002-09-08 17:28 UTC] mose at ns dot cune dot edu
Bzzzzzt.  Bogus, my foot.  Thanks for playing, but it is a bug, not a support question.  I see that this bug was reported in July, and it still is not fixed.  Here I thought it wasn't fixed because no one reported it.  Take a look at bug #19281 and get a move on.  Chop, chop.
 [2004-08-11 20:34 UTC] jfprado at mixmail dot com
It adds this line so that it works to you:

ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 14:01:32 2025 UTC