ID: 29895 User updated by: sonny at sun dot com Reported By: sonny at sun dot com Status: Open Bug Type: LDAP related Operating System: Fedora Core 2 PHP Version: 4.3.8, 5.0.1 New Comment:
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 Previous Comments: ------------------------------------------------------------------------ [2004-10-01 11:10:35] sonny at sun dot com 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. ------------------------------------------------------------------------ [2004-10-01 10:01:58] [EMAIL PROTECTED] Do the openldap (assuming you're using openldap since you didn't say what you actually use) CLI tools work? This might be some weird permission issue. Maybe the user as what you run the script doesn't have rights to read the ldap ini files or something alike. And have you tried to run it on command line while you have Apache running? (this shouldn't matter..but try run it when you've shutdown Apache) ------------------------------------------------------------------------ [2004-08-30 12:58:25] 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. [EMAIL PROTECTED] parser]$ php4 t.php Warning: ldap_close() expects parameter 1 to be resource, boolean given in t.php on line 5 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29895&edit=1