gpt4 book ai didi

php - 更新 : Apache Chokes on PHP ldap_connect() Call

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:42:56 24 4
gpt4 key购买 nike

如果我在命令行上运行以下 PHP 代码,我会得到预期的结果:

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); ?>

Apache 断开连接,例如,如果我从命令行点击脚本,这就是 cURL 返回的内容:

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 库都被加载了。

最佳答案

我看到您通过升级包解决了您的问题,但是如果您需要进一步调试正在发生的事情,您可以在 ldap_connect() 之前启用调试输出,如下所示:

ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);

应该用库调用填充 error.log

关于php - 更新 : Apache Chokes on PHP ldap_connect() Call,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3800988/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com