Question

Am using LDAP in My Project. PHP Version 5.4.9-4ubuntu2.4. I have also installed the package php5-ldap. when try to use the Function ldap_control_paged_result(). Am getting Fatal error.

SAmple code 
<?php 
  $link = ldap_connect('192.167.20.107',389);
  ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 3);
  ldap_bind($link,'Administrator@ldapwindows.local','PaSSw0rd');
  $cookie = '';     
  $test = ldap_control_paged_result($link,1000, TRUE, $cookie);
  $sr = ldap_search($link,'','(&(SAMAccountname=*)objectClass=user))',array('SAMAccountname'),null,null,null,null);
  $entries = ldap_get_entries($link, $sr);
  echo $entries;
  $test2= ldap_control_paged_result_response($link, $sr, $cookie, $estimated);
  ?>
Était-ce utile?

La solution

The function is incorrect and doesn't exist. You should use ldap_control_paged_result Notice there is no s at the end of result

Autres conseils

In my case I wasn't able to upgrade my php due Client restrictions. Just if someone is in my same situation: I patched the ldap module using php 5.3.3 source and the proper Patch

from Red Hat 6.5 x86_64

tar xf php-5.3.3.tar.gz
cd php-5.3.3/ext/ldap
sudo yum install php-devel openldap-devel cyrus-sasl-devel
sudo ln -s /usr/lib64/libldap.so /usr/lib/libldap.so
sudo ln -s /usr/lib64/libldap_r.so /usr/lib/libldap_r.so
phpize
./configure
make
sudo cp modules/ldap.so /usr/lib64/php/modules/ldap.so
sudo service httpd restart
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top