phacility/phabricator · error · Exception

Before you can set up or use LDAP, you need to install the P

Error message

Before you can set up or use LDAP, you need to install the PHP LDAP extension. It is not currently installed, so PHP can not talk to LDAP. Usually you can install it with `%s`, `%s`, or a similar package manager command.

What it means

Thrown by PhabricatorLDAPAuthProvider::assertLDAPExtensionInstalled() (checks function_exists('ldap_bind')) when PHP was built or loaded without the ldap extension, so it cannot talk to LDAP at all. The message includes distro-specific install commands (yum/apt). It is an environment-check Exception raised before any LDAP connection is attempted, both when configuring and when using the LDAP provider.

Source

Thrown at src/applications/auth/provider/PhabricatorLDAPAuthProvider.php:260

          $values[$key] = $request->getStr($key);
          break;
      }
    }

    return $values;
  }

  public function processEditForm(
    AphrontRequest $request,
    array $values) {
    $errors = array();
    $issues = array();
    return array($errors, $issues, $values);
  }

  public static function assertLDAPExtensionInstalled() {
    if (!function_exists('ldap_bind')) {
      throw new Exception(
        pht(
          'Before you can set up or use LDAP, you need to install the PHP '.
          'LDAP extension. It is not currently installed, so PHP can not '.
          'talk to LDAP. Usually you can install it with '.
          '`%s`, `%s`, or a similar package manager command.',
          'yum install php-ldap',
          'apt-get install php5-ldap'));
    }
  }

  public function extendEditForm(
    AphrontRequest $request,
    AphrontFormView $form,
    array $values,
    array $issues) {

    self::assertLDAPExtensionInstalled();

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Install the ldap extension for the exact PHP build in use: `apt-get install php-ldap` (Debian/Ubuntu) or `yum install php-ldap` (RHEL/CentOS) — on Docker PHP images use `docker-php-ext-install ldap` after installing libldap-dev.
  2. Ensure `extension=ldap` is enabled in the php.ini used by the web SAPI (check via phpinfo() over HTTP, not just `php -m`).
  3. Restart php-fpm/Apache completely so the extension loads, then re-run the LDAP setup or login.
  4. Verify with a quick probe: `php -r 'var_dump(function_exists("ldap_bind"));'` executed under the same SAPI/user as the web stack.
Defensive patterns

Strategy: validation

Validate before calling

// Call the built-in guard early (e.g. at provider setup entry points)
PhabricatorLDAPAuthProvider::assertLDAPExtensionInstalled();
// or inline: if (!function_exists('ldap_bind')) { /* block LDAP setup */ }

Prevention

When it happens

Trigger: Creating or using the LDAP auth provider on a host whose PHP lacks ext-ldap: the package was never installed, the extension is commented out of the loaded php.ini, the web SAPI and CLI load different extension sets, or the PHP version was upgraded and the versioned php-ldap package was dropped.

Common situations: Slim Docker PHP images (php:fpm without ext-ldap); Debian/RHEL PHP split packages where php5-ldap/php7.x-ldap/php-ldap was missed; a PHP upgrade changed the extensions directory so old .so files stopped loading; opcache/extension config drift between fpm and cli.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/0f09f770cb03231d. Report an issue: GitHub.