简体   繁体   English

调试Moodle的LDAP身份验证

[英]Debugging for LDAP authentication for Moodle

I have configured the LDAP authentication and added /auth/ldap/cli/sync_users.php to the crontab as described in the official manual: http://docs.moodle.org/26/en/LDAP_authentication . 我已经配置了LDAP身份验证,并将/auth/ldap/cli/sync_users.php添加到crontab中,如官方手册中所述: http/auth/ldap/cli/sync_users.php

But with no luck the LDAP thingy seemed to be failing to work properly. 但没有运气,LDAP似乎无法正常工作。 I believe the cron job has been set up properly, so I suppose I may have made some mistakes, or not providing enough information in the configuration for the LDAP authentication plugin. 我相信cron作业已经正确设置,所以我想我可能犯了一些错误,或者没有在LDAP身份验证插件的配置中提供足够的信息。

As the cron script must be called from the command line, and I only have access to the FTP and MySQL database on the server, I have no idea how to execute the file to check if there are any errors (for debugging purpose). 由于必须从命令行调用cron脚本,并且我只能访问服务器上的FTP和MySQL数据库,所以我不知道如何执行该文件来检查是否存在任何错误(用于调试目的)。

So, I would like to know the proper way(s) to debug the LDAP authentication. 所以,我想知道调试LDAP身份验证的正确方法。 Please let me know if I am not making it clear enough. 如果我说得不够清楚,请告诉我。 I could provide more details if needed. 如果需要,我可以提供更多细节。
Thank you. 谢谢。

        • UPDATES * * * * 更新 * * * *

I have tried to run the /admin/cron.php on a browser, and I have found the following lines in the output. 我试图在浏览器上运行/admin/cron.php ,我在输出中找到了以下行。

Running auth crons if required...
... started 10:24:18. Current memory use 27.9MB.

Does it have anything to do with the LDAP authentication? 它与LDAP身份验证有什么关系吗? And what does it imply here? 它在这里意味着什么?

Have you got something like this in your cron? 你的cron中有这样的东西吗?

*/15 * * * * /usr/bin/php  /path/to/moodle/auth/ldap/cli/sync_users.php >/dev/null

You could probably redirect the output to a log file to see whats going on. 您可以将输出重定向到日志文件以查看最新情况。

*/15 * * * * /usr/bin/php  /path/to/moodle/auth/ldap/cli/sync_users.php > /path/to/home/ldaperrors.log 2>&1

Also try it with debugging - add these to the config.php - not on a production site though, otherwise your users might see lots of errors. 还可以尝试调试 - 将这些添加到config.php - 但不是在生产站点上,否则您的用户可能会看到很多错误。

@error_reporting(E_ALL | E_STRICT);
@ini_set('display_errors', '1');
$CFG->debug = (E_ALL | E_STRICT);
$CFG->debugdisplay = 1;

For those who stumble upon this via a search... In Moodle 3.0 and above, cron jobs can be viewed and run from Site Administration>Server>Scheduled Tasks. 对于那些通过搜索偶然发现的人...在Moodle 3.0及更高版本中,可以从“站点管理”>“服务器”>“计划任务”查看和运行cron作业。

Very useful to view output of the task (in this case the LDAP authentication). 查看任务输出非常有用(在本例中为LDAP身份验证)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM