diff --git a/setup/setup_demo.php b/setup/setup_demo.php
index ecee8cd7d1..9649986c05 100644
--- a/setup/setup_demo.php
+++ b/setup/setup_demo.php
@@ -130,6 +130,12 @@
$GLOBALS['phpgw']->db = $phpgw_setup->db;
$GLOBALS['phpgw']->common = CreateObject('phpgwapi.common');
$GLOBALS['phpgw']->accounts = CreateObject('phpgwapi.accounts');
+ if(($GLOBALS['phpgw_info']['server']['account_repository'] == 'ldap') &&
+ !$GLOBALS['phpgw']->accounts->ds)
+ {
+ printf("Error: Error connecting to LDAP server %s!
",$GLOBALS['phpgw_info']['server']['ldap_host']);
+ exit;
+ }
/* Begin transaction for acl, etc */
$phpgw_setup->db->transaction_begin();