> For the complete documentation index, see [llms.txt](https://icehrm.gitbook.io/icehrm/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://icehrm.gitbook.io/icehrm/api-and-single-sign-on/using-ldap.md).

# Using LDAP

{% hint style="danger" %}
The latest documentation is available [here](https://icehrm.com/explore/docs/using-ldap/).
{% endhint %}

This section describe the process of configuring LDAP with IceHrm

### PHP ldap extension

PHP LDAP extension should be installed for LDAP to work. Also make sure you can connect ot the LDAP host via the provided port

Before using please install php-ldap module.

**For PHP 5.3** `$> sudo apt-get install php5-ldap`

**For PHP 7.0** `$> sudo apt-get install php-ldap`

**For PHP 7.**`3` `$> sudo apt-get install php7.3-ldap`

For using php ldap on windows please [refer](http://stackoverflow.com/questions/16864306/fatal-error-call-to-undefined-function-ldap-connect)

### Enabling LDAP

LDAP can be enabled via System -> Settings -> LDAP. Make sure to configure all the parameters correctly

### Creating a LDAP User

IceHrm can not extract users automatically from LDAP. You need to create a matching user in IceHrm with the same username. For an example if you have a user in your LDAP with username "**user1"** and password **"pass123"**. Then you need to:

1. Create a user in icehrm with username "user1"
2. No need to set a password, as we will use LDAP to authenticate this user
3. The new user can login with username "user1" and password "pass123", which is his/her LDAP password

### No LDAP for user with username "admin"

The user "admin" will always login with local db username and password (even LDAP is enabled)

### Testing LDAP with a test server

This is a way to debug your LDAP setup. You can try to connect to a test LDAP server to find out if the problem is with your LDAP setup or if IceHrm

Use these config to test LDAP connection with following test LDAP server <http://www.forumsys.com/tutorials/integration-how-to/ldap/online-ldap-test-server/>

#### Change configs as follows under System->Settings

| Setting                  | Description                          |
| ------------------------ | ------------------------------------ |
| `LDAP: Enabled`          | Yes                                  |
| `LDAP: Server`           | ldap.forumsys.com                    |
| `LDAP: Port`             | 389                                  |
| `LDAP: Root DN`          | dc=example,dc=com                    |
| `LDAP: Manager DN`       | cn=read-only-admin,dc=example,dc=com |
| `LDAP: Manager Password` | password                             |
| `LDAP: Version 3`        | Yes                                  |
| `LDAP: User Filter`      | uid={}                               |

Then create a user with username "riemann" under System->Users

Logout and try login with riemann/password

### Issue with LDAP

If you are facing login issues after enabling LDAP, you can still login as user "admin" and disable LDAP


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://icehrm.gitbook.io/icehrm/api-and-single-sign-on/using-ldap.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
