{"record":{"id":"0f09f770cb03231d","repo":"phacility/phabricator","slug":"before-you-can-set-up-or-use-ldap-you-need-to-ins","errorCode":null,"errorMessage":"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.","messagePattern":"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 `(.+?)`, `(.+?)`, or a similar package manager command\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/auth/provider/PhabricatorLDAPAuthProvider.php","lineNumber":260,"sourceCode":"          $values[$key] = $request->getStr($key);\n          break;\n      }\n    }\n\n    return $values;\n  }\n\n  public function processEditForm(\n    AphrontRequest $request,\n    array $values) {\n    $errors = array();\n    $issues = array();\n    return array($errors, $issues, $values);\n  }\n\n  public static function assertLDAPExtensionInstalled() {\n    if (!function_exists('ldap_bind')) {\n      throw new Exception(\n        pht(\n          'Before you can set up or use LDAP, you need to install the PHP '.\n          'LDAP extension. It is not currently installed, so PHP can not '.\n          'talk to LDAP. Usually you can install it with '.\n          '`%s`, `%s`, or a similar package manager command.',\n          'yum install php-ldap',\n          'apt-get install php5-ldap'));\n    }\n  }\n\n  public function extendEditForm(\n    AphrontRequest $request,\n    AphrontFormView $form,\n    array $values,\n    array $issues) {\n\n    self::assertLDAPExtensionInstalled();\n","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php#L242-L278","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Ensure `extension=ldap` is enabled in the php.ini used by the web SAPI (check via phpinfo() over HTTP, not just `php -m`).","Restart php-fpm/Apache completely so the extension loads, then re-run the LDAP setup or login.","Verify with a quick probe: `php -r 'var_dump(function_exists(\"ldap_bind\"));'` executed under the same SAPI/user as the web stack."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Call the built-in guard early (e.g. at provider setup entry points)\nPhabricatorLDAPAuthProvider::assertLDAPExtensionInstalled();\n// or inline: if (!function_exists('ldap_bind')) { /* block LDAP setup */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install php-ldap in the base image and assert `php -m | grep ldap` in CI/deploy checks.","After PHP upgrades, re-verify that versioned extension packages are still installed and enabled.","Check phpinfo() served over HTTP (web SAPI), not only the CLI, before configuring LDAP."],"tags":["phabricator","ldap","php","missing-extension","environment"],"backgroundTag":"missing-php-extension","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}