Apache-2.2

Apache 2.4 和 PHP 5.5,PHP 中的 LDAP 不工作

  • June 5, 2014

我正在使用執行 Debian 7.4 的伺服器,它目前正在執行 PHP 5.5.12 和 Apache 2.2.22。我正在嘗試升級到 Apache 2.4.9,以便我可以啟用完美前向保密。

我下載了 Apache 2.4.9 作為原始碼,並使用以下標誌成功編譯了它:

./configure --enable-so --with-included-apr --with-pcre --with-ldap --with-perl

我還下載了 PHP 5.5.12 作為原始碼並使用這些標誌進行了編譯:

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-pdo-mysql=mysqlnd --with-openssl --with-gd --with-zlib --enable-shmop --enable-sockets --enable-sysvsem --enable-sysvshm --enable-mbstring --with-iconv --with-litespeed --with-ldap --with-mcrypt

我已經對 Apache 2.4 完成了所有必要的配置(httpd.conf 等),以啟用完美前向保密並啟用所有必要的模組(我認為)。我故意將 Apache 2.4 安裝到與 Apache 2.2 不同的目錄中,這樣我就可以關閉 Apache 2.2 並啟動 Apache 2.4(它是生產伺服器,無法承受停機時間)。當我啟動 Apache 2.4 時,一切都很好,除了使用 PHP 連接到 LDAP 伺服器。沒有錯誤被拋出,它根本不起作用;就好像它超時了。奇怪的是,當我切換回 Apache 2.2 時,PHP 中的 LDAP 工作得很好。有誰知道為什麼會發生這種情況?

我最終自己解決了這個問題。問題實際上是文件/文件夾權限;我有一個腳本,它使用 exec() hack 來 ping 幾個 LDAP 伺服器,並且 ping 函式無法寫入 tmp 文件夾。LDAP 一直執行良好,這是問題的根源。

引用自:https://serverfault.com/questions/599723