开发者

PHP how to specify ldap.conf location?

I have a PHP compiled with ldap support and it is working as expected. Now, I need to do some configuration for SSL/TLS but I have no ldap.conf file.

php -i says it was compiled --with-ldap=/usr so I suppose I should m开发者_Python百科ake the ldap.conf file in /usr, but I have no write permission there because of an architectural limitation of the device.

How can I specify the path to ldap.conf for php? Is there an php.ini setting? Maybe a parameter in command line?


See http://php.net/manual/en/function.ldap-connect.php#36156:

You also need to place those same settings in a file within the Apache Web user homedir called .ldaprc e.g.: cp /usr/local/openldap/etc/openldap/ldap.conf ~www/.ldaprc )

The apache web server root directory is the key here, as well as .ldaprc.

Also see the official ldap man pages:

Users may create an optional configuration file, ldaprc or .ldaprc, in their home directory which will be used to override the system-wide defaults file. The file ldaprc in the current working directory is also used.


Under XAMPP on Windows the ldap.conf must be either in the root of the system (c:\ldap.conf, PHP 5.3.3 if I remember correctly) or in C:\openldap\sysconf\ depending on the PHP version. It seems the path is not configurable because hardcoded in the Windows PHP DLLs. See the comments at http://se2.php.net/manual/en/ref.ldap.php


For XAMPP on Windows, the path is C:\openldap\sysconf\ldap.conf and place these two lines in the ldap.conf file:

TLS_REQCERT never

TLS_CACERT {full_path_to_pem_file}\pem_file.pem

Restart web server and it worked for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜