2010-09-27 47 views
4

如果我運行命令行我得到預期的結果在下面的PHP代碼:更新:Apache的扼流圈上的PHP ldap_connect()調用

php -r 'var_dump(ldap_connect("ldaps://ldaps.example.com", 636));' 
resource(4) of type (ldap link) 

但是如果我把這個PHP腳本

<?php ldap_connect("ldaps://ldaps.example.com", 636); ?> 

阿帕奇斷開連接,例如這是捲曲的回報,如果我打的腳本命令行:

curl http://example.com/ldap_test.php 
curl: (52) Empty reply from server 

Apache access_log永遠不會顯示該頁面的命中,並且error_log爲空。

我知道LDAP服務器正在工作,因爲我已經在另外兩臺服務器上測試過了。我正在開發一個運行PHP 5.2.9和Apache的Joyent加速器。任何人都知道爲什麼Apache會因此而窒息?

更新:

今天我在運行問題腳本時使用GDB調試Apache。當腳本命中ldap_connect()行我得到了GDB如下:

Program received signal SIGSEGV, Segmentation fault. 
0xfe94b8bb in _free_unlocked() from /lib/libc.so.1 

我不知道是什麼原因造成的段錯誤還,但至少我知道,Apache的實際崩潰。

以下是完整的回溯:

Breakpoint 1, 0x08094417 in ap_process_request() 
(gdb) c 
Continuing. 

Program received signal SIGSEGV, Segmentation fault. 
0xfe94b8bb in _free_unlocked() from /lib/libc.so.1 
(gdb) where 
#0 0xfe94b8bb in _free_unlocked() from /lib/libc.so.1 
#1 0xfe94b86f in free() from /lib/libc.so.1 
#2 0xfde2d7e8 in ldap_x_free() from /usr/lib/libldap.so.5 
#3 0xfde3f78b in ldap_free_urldesc() from /usr/lib/libldap.so.5 
#4 0xfd0943d9 in ldap_free_urllist() from /opt/local/lib/libldap-2.4.so.2 
#5 0xfd087191 in ldap_ld_free() from /opt/local/lib/libldap-2.4.so.2 
#6 0xfd07ce8f in ldap_initialize() from /opt/local/lib/libldap-2.4.so.2 
#7 0xfd3831a1 in zif_ldap_connect() from /opt/local/lib/php/20040412/ldap.so 
#8 0xfcbda874 in zend_do_fcall_common_helper_SPEC() 
    from /opt/local/lib/httpd/mod_php5.so 
#9 0xfcbe1a23 in ZEND_DO_FCALL_SPEC_CONST_HANDLER() 
    from /opt/local/lib/httpd/mod_php5.so 
#10 0xfcbd9e99 in execute() from /opt/local/lib/httpd/mod_php5.so 
#11 0xfcbda985 in zend_do_fcall_common_helper_SPEC() 
    from /opt/local/lib/httpd/mod_php5.so 
#12 0xfcbdad65 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER() 
    from /opt/local/lib/httpd/mod_php5.so 
#13 0xfcbd9e99 in execute() from /opt/local/lib/httpd/mod_php5.so 
#14 0xfcbda985 in zend_do_fcall_common_helper_SPEC() 
    from /opt/local/lib/httpd/mod_php5.so 
#15 0xfcbdad65 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER() 
    from /opt/local/lib/httpd/mod_php5.so 
#16 0xfcbd9e99 in execute() from /opt/local/lib/httpd/mod_php5.so 
---Type <return> to continue, or q <return> to quit--- 
#17 0xfcbda985 in zend_do_fcall_common_helper_SPEC() 
    from /opt/local/lib/httpd/mod_php5.so 
#18 0xfcbdad65 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER() 
    from /opt/local/lib/httpd/mod_php5.so 
#19 0xfcbd9e99 in execute() from /opt/local/lib/httpd/mod_php5.so 
#20 0xfcbda985 in zend_do_fcall_common_helper_SPEC() 
    from /opt/local/lib/httpd/mod_php5.so 
#21 0xfcbdad65 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER() 
    from /opt/local/lib/httpd/mod_php5.so 
#22 0xfcbd9e99 in execute() from /opt/local/lib/httpd/mod_php5.so 
#23 0xfcbda985 in zend_do_fcall_common_helper_SPEC() 
    from /opt/local/lib/httpd/mod_php5.so 
#24 0xfcbdad65 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER() 
    from /opt/local/lib/httpd/mod_php5.so 
#25 0xfcbd9e99 in execute() from /opt/local/lib/httpd/mod_php5.so 
#26 0xfcbda985 in zend_do_fcall_common_helper_SPEC() 
    from /opt/local/lib/httpd/mod_php5.so 
#27 0xfcbdad65 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER() 
    from /opt/local/lib/httpd/mod_php5.so 
#28 0xfcbd9e99 in execute() from /opt/local/lib/httpd/mod_php5.so 
#29 0xfcbda985 in zend_do_fcall_common_helper_SPEC() 
    from /opt/local/lib/httpd/mod_php5.so 
#30 0xfcbdad65 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER() 
---Type <return> to continue, or q <return> to quit--- 
    from /opt/local/lib/httpd/mod_php5.so 
#31 0xfcbd9e99 in execute() from /opt/local/lib/httpd/mod_php5.so 
#32 0xfcbda985 in zend_do_fcall_common_helper_SPEC() 
    from /opt/local/lib/httpd/mod_php5.so 
#33 0xfcbdad65 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER() 
    from /opt/local/lib/httpd/mod_php5.so 
#34 0xfcbd9e99 in execute() from /opt/local/lib/httpd/mod_php5.so 
#35 0xfcbda985 in zend_do_fcall_common_helper_SPEC() 
    from /opt/local/lib/httpd/mod_php5.so 
#36 0xfcbdad65 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER() 
    from /opt/local/lib/httpd/mod_php5.so 
#37 0xfcbd9e99 in execute() from /opt/local/lib/httpd/mod_php5.so 
#38 0xfcbbebaa in zend_execute_scripts() from /opt/local/lib/httpd/mod_php5.so 
#39 0xfcb7f40e in php_execute_script() from /opt/local/lib/httpd/mod_php5.so 
#40 0xfcc509ca in php_handler() from /opt/local/lib/httpd/mod_php5.so 
#41 0x08085c2a in ap_run_handler() 
#42 0x0808638e in ap_invoke_handler() 
#43 0x08094ca7 in ap_internal_redirect() 
#44 0xfe48c232 in handler_redirect() from /opt/local/lib/httpd/mod_rewrite.so 
#45 0x08085c2a in ap_run_handler() 
#46 0x0808638e in ap_invoke_handler() 
#47 0x08094471 in ap_process_request() 
#48 0x0809177c in ap_process_http_connection() 
---Type <return> to continue, or q <return> to quit--- 
#49 0x0808d426 in ap_run_process_connection() 
#50 0x0808d858 in ap_process_connection() 
#51 0x08099e89 in child_main() 
#52 0x08099f65 in make_child() 
#53 0x0809a472 in ap_mpm_run() 
#54 0x080709ab in main() 
(gdb) 

更新2:

從我可以告訴這兩個函數的問題開始呼籲:

#3 0xfde3f78b in ldap_free_urldesc() from /usr/lib/libldap.so.5 
#4 0xfd0943d9 in ldap_free_urllist() from /opt/local/lib/libldap-2.4.so.2 

#4中的作用(ldap_free_urllist)是從/opt/local/lib/libldap-2.4.so.2中的庫調用的,#3是從/usr/lib/libldap.so.5中的庫調用的。我不知道是否是正常的,但我會認爲它不正常。所以不知怎麼,這些LDAP庫都被加載了。

+0

我得到以下錯誤:不能聯繫LDAP服務器,當我不使用ldaps:// – macinjosh 2010-09-27 04:50:35

+0

我相信ldap_connect()只是返回一個資源,而不建立連接,直到你調用下一個函數(例如ldap_bind),你打電話給什麼更多的ldap_x函數?編輯:對不起,刪除我的評論以上:) – Scuzzy 2010-09-27 04:51:03

+0

我不會在我的測試腳本中調用其他任何東西。我從字面上只調用ldap_connect()。這只是我在問題中的代碼行。 – macinjosh 2010-09-27 04:52:04

回答

3

我看到你通過升級包修正了自己的問題,但如果你需要進一步調試發生了什麼事情,您可以啓用前的ldap_connect()像這樣調試輸出:

ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7); 

這應該填寫的error.log與庫調用

相關問題