如何从mod_php查看PHP的ldap_ *函数(使用LDAP_OPT_DEBUG_LEVEL = 7)的stderr [英] How to view stderr of PHP's ldap_* functions (with LDAP_OPT_DEBUG_LEVEL=7) from mod_php

查看:99
本文介绍了如何从mod_php查看PHP的ldap_ *函数(使用LDAP_OPT_DEBUG_LEVEL = 7)的stderr的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以从PHP 5.4.16 CLI运行以下命令:

I can run the following from the PHP 5.4.16 CLI:

ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
$conn = ldap_connect($hostname);
ldap_bind($conn, $ldaprdn);

我将获得很多调试输出到stderr,它的开始是这样的:

And I will get a lot of debug output to stderr that starts like this:

ldap_create
ldap_url_parse_ext(ldaps://ldap.example.com)
ldap_bind_s
ldap_simple_bind_s
ldap_sasl_bind_s
ldap_sasl_bind
ldap_send_initial_request
...

这对于在CLI上进行调试非常有用.但是,我需要在Apache 2.2.15 mod_php内进行调试,因为我发现那里存在间歇性的LDAP连接,无法在命令行上进行复制.

That is great for debugging on the CLI. However, I need to debug from within Apache 2.2.15 mod_php because I am seeing intermittent LDAP connectivity there that I cannot reproduce on the command line.

认为我可以从Web服务器运行相同的代码,并在Apache的错误日志中看到调试信息,但是消息未显示在那里. PHP错误/警告肯定会进入错误日志,我尝试了error_reporting(-1),但无法将这些调试消息显示在任何地方.

I thought I could run the same code from the web server and see that debug information in Apache's error log, but the messages are not showing up there. PHP errors/warnings are definitely going to the error log, and I tried error_reporting(-1), but can't get those debug messages to show anywhere.

在Apache下运行时,是否可以通过某种方式查看这些stderr调试消息?

Is there some way I can see those stderr debug messages when running under Apache?

推荐答案

答案是正在记录这些消息 ,但是将它们记录到不同日志文件中,而不是error_log()消息发送.在我的Apache conf中,每个虚拟主机都有自己的错误日志文件.还有一个全局错误日志文件,其中会显示Apache启动/关闭消息.

The answer is that those messages are being logged, but to a different log file than where the error_log() messages go. In my Apache conf, each virtual host has its own error log file. There is also a global error log file where Apache startup/shutdown messages show up.

我正在虚拟主机上运行这些LDAP调试脚本,并希望错误输出进入主机的已定义错误日志……就像所有其他错误消息一样.但是由于某些原因,那些ldap调试行会发送到全局错误日志.

I was running these LDAP debug scripts on a virtual host and expecting the error output to go to the host's defined error log... just like all other error messages do. But for some reason those ldap debug lines get sent to the global error log.

这篇关于如何从mod_php查看PHP的ldap_ *函数(使用LDAP_OPT_DEBUG_LEVEL = 7)的stderr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆