diff --git a/ldap_servers/LdapServer.class.php b/ldap_servers/LdapServer.class.php
index 1fa9f37..ecba7d9 100644
--- a/ldap_servers/LdapServer.class.php
+++ b/ldap_servers/LdapServer.class.php
@@ -272,8 +272,13 @@ class LdapServer {
    */
   function connect() {
 
-    if (!$con = ldap_connect($this->address, $this->port)) {
-      watchdog('user', 'LDAP Connect failure to ' . $this->address . ':' . $this->port);
+    $resolved_port = $this->port;
+    if (!is_numeric($resolved_port)) {
+      // If it's a string, then attempt to use it as the name of a PHP constant.
+      $resolved_port = constant($resolved_port);
+    }
+    if (!$con = ldap_connect($this->address, $resolved_port)) {
+      watchdog('user', 'LDAP Connect failure to ' . $this->address . ':' . $resolved_port);
       return LDAP_CONNECT_ERROR;
     }
 
diff --git a/ldap_servers/LdapServerAdmin.class.php b/ldap_servers/LdapServerAdmin.class.php
index be8c2e7..b3af088 100644
--- a/ldap_servers/LdapServerAdmin.class.php
+++ b/ldap_servers/LdapServerAdmin.class.php
@@ -365,11 +365,6 @@ class LdapServerAdmin extends LdapServer {
       }
     }
 
-
-    if (!is_numeric($this->port)) {
-      $errors['port'] =  t('The TCP/IP port must be an integer.');
-    }
-
     if ($this->bind_method == LDAP_SERVERS_BIND_METHOD_USER && !$this->user_dn_expression) {
       $errors['user_dn_expression'] =  t('When using "Bind with Users Credentials", Expression for user DN is required');
     }
@@ -620,13 +615,14 @@ public function drupalFormSubmit($op, $values) {
           'fieldset' => 'server',
           '#type' => 'textfield',
           '#title' => t('LDAP port'),
-          '#size' => 5,
-          '#description' => t('The TCP/IP port on the above server which accepts LDAP connections. Must be an integer.'),
+          '#size' => 50,
+          '#description' => t('The TCP/IP port on the above server which accepts LDAP connections. You may provide a string PHP constant, which must contain the port number.'),
         ),
         'schema' => array(
-          'type' => 'int',
+          'type' => 'varchar',
           'not null' => FALSE,
-          'default' => 389,
+          'default' => '389',
+          'length' => 255,
         ),
       ),
 
diff --git a/ldap_servers/ldap_servers.install b/ldap_servers/ldap_servers.install
index aa7b9b9..e4df93a 100644
--- a/ldap_servers/ldap_servers.install
+++ b/ldap_servers/ldap_servers.install
@@ -814,6 +814,18 @@ function ldap_servers_update_7206() {
   }
 }
 
+/**
+ * Change port to allow either a string PHP constant or an integer.
+ */
+function ldap_servers_update_7207() {
+  db_change_field('ldap_servers', 'port', 'port', array(
+    'type' => 'varchar',
+    'not null' => FALSE,
+    'default' => '389',
+    'length' => 255,
+  ));
+}
+
 function ldap_servers_install_update_schema($schema, &$change_log) {
   foreach ($schema as $table_name => $table_schema) {
     foreach ($table_schema['fields'] as $field_name => $field_schema) {