PHP:ldap_bind 使用 SSL 绑定时出现 500 内部服务器错误,但不是常规绑定

PHP: ldap_bind gives 500 Internal Server Error when binding with SSL but not regular bind

我在 Windows Server 2016 上有一个 Laravel 应用程序,带有 IIS 10 和 PHP 7.2。

应用程序需要进行 Active Directory 身份验证。为此,我使用 https://github.com/Adldap2/Adldap2-Laravel。 身份验证适用于在端口 3268 上与公司 DC 的常规 LDAP 连接,但是当我启用 SSL 并将其连接到端口 3269 或 636 时,当我的代码达到 [=35= 时,我收到 500:内部服务器错误 "The FastCGI process exited unexpectedly" ]().

我知道 SSL 在 DC 上工作,因为我可以使用 ldp.exe 工具连接到同一台服务器。

这是我在应用程序中用于身份验证的配置(使用默认登录控制器)

LDAP_HOSTS='dc.example.corp.com'
LDAP_PORT=636
LDAP_BASE_DN=''
LDAP_USE_SSL=true
LDAP_USE_TLS=false

LDAP_USERNAME=######################
LDAP_PASSWORD=############

我通常在 public 目录中使用以下代码对文件进行测试:

$a = ldap_connect("ldaps://dc.example.corp.com:636");
ldap_set_option($a, LDAP_OPT_PROTOCOL_VERSION, 3);  // v3 = UTF8 encoding
ldap_set_option($a, LDAP_OPT_REFERRALS, 0);
$r=ldap_bind($a);

echo "-$r-";

我也尝试过使用 DebugDiag 进行调试,但是在分析崩溃创建的转储时 returns 出现以下错误:

Description Recommendation
WARNING - DebugDiag was not able to locate debug symbols for \libcrypto-1_1.dll, so the information below may be incomplete.

In php__PID__6684__Date__11_28_2019__Time_10_24_08AM__912__Second_Chance_Exception_C0000005.dmp the assembly instruction at libcrypto_1_1!CRYPTO_memcmp+29530 in C:\Program Files (x86)\PHP\v7.2\libcrypto-1_1.dll from The OpenSSL Project, https://www.openssl.org/ has caused an access violation exception (0xC0000005) when trying to read from memory location 0x2a4b6fe0 on thread 0
Please follow up with the vendor The OpenSSL Project, https://www.openssl.org/ for C:\Program Files (x86)\PHP\v7.2\libcrypto-1_1.dll

还有数百行说同样的话:

libcrypto_1_1!CRYPTO_memcmp+29594

目前我不知道问题出在哪里,也不确定如何进行。

我已经能够通过进一步查看 libcrypto 消息来解决我自己的问题。我在使用 php 7.2.14 和 openssl 1.1.1 (bugs.php.net/bug.php?id=77440) 时发现了一个引用错误的 post。

我删除了我的 libcrypto-1_1.dll 和 libssl-1_1.dll 文件,并用 openssl 1.1.0j 中的一次替换了它们。重新启动我的服务器后一切正常!