|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-08-30 12:58 UTC] sonny at sun dot com
Description:
------------
Just using a simple Script to try to connect to an LDAP Server. (see below)
If I execute this script via apache mod_php4 it works fine a I get an Resource Handle back.
But using CLI cause the same script an connection failed.
The same behavior is in php 5.0.1.
Module ldap is laoded via php.ini, because it's shared compliled.
Reproduce code:
---------------
$ld = ldap_connect("ldap.example,com", "389");
print_r($ld);
ldap_close($ld);
Expected result:
----------------
Working as well in CLI as well as module/SAPI.
Actual result:
--------------
Connect failed in CLI.
[root@pecl parser]$ php4 t.php
Warning: ldap_close() expects parameter 1 to be resource, boolean given in t.php on line 5
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 20 20:00:01 2025 UTC |
Yep I'm using standard openldap installation from Fedora. Just checked if cli tools from openldap works .. YES. Sample: ldapsearch -h example.com -b dc=example,dc=com -s sub -p 389 employeenumber=tester -x # search result search: 2 result: 0 Success # numResponses: 2 # numEntries: 1 I don't belive in a persission issue - while I have test the scripts as root. While webserver was shutdown the same behavior - as expected. I have try to strace the programm an found this srange/error: fstat64(4, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0 lseek(4, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) dup(1) = 5 fstat64(5, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 lseek(5, 0, SEEK_CUR) = 0 dup(2) = 6 fstat64(6, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0 lseek(6, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) Maybe this can help.Aditional info to strace: read(3, "<?php\n\n$ld = ldap_connect(\'129.1"..., 8192) = 88 read(3, "", 4096) = 0 read(3, "", 8192) = 0 close(3) = 0 munmap(0xf6d4d000, 4096) = 0 mmap2(NULL, 143360, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf6d2a000 fcntl64(147436232, F_SETFD, FD_CLOEXEC) = -1 EBADF (Bad file descriptor) fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf6d29000 write(1, "\n", 1 ) = 1 write(1, "Warning: ldap_close() expects pa"..., 99Warning: ldap_close() expects parameter 1 to be resource, boolean given in /tmp/ldap.php on line 6