diff --git a/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php index e45d053c60..e7afcc48d1 100644 --- a/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php @@ -15,6 +15,8 @@ final class PhabricatorAuthManagementLDAPWorkflow $console = PhutilConsole::getConsole(); $console->getServer()->setEnableLog(true); + PhabricatorLDAPAuthProvider::assertLDAPExtensionInstalled(); + $provider = PhabricatorLDAPAuthProvider::getLDAPProvider(); if (!$provider) { $console->writeOut( diff --git a/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php b/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php index c663f80fc1..e722cb1db8 100644 --- a/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php @@ -251,12 +251,26 @@ final class PhabricatorLDAPAuthProvider extends PhabricatorAuthProvider { 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 '. + '`yum install php-ldap`, `apt-get install php5-ldap`, or a '. + 'similar package manager command.')); + } + } + public function extendEditForm( AphrontRequest $request, AphrontFormView $form, array $values, array $issues) { + self::assertLDAPExtensionInstalled(); + $labels = $this->getPropertyLabels(); $captions = array(