$val) { if (!$val) unset($setup_conf[$key]); else if ($val[0] == "#") unset($setup_conf[$key]); else { $vals = explode("=", $val); $setup[$vals[0]] = $vals[1]; } } // check if required modules are loaded $extensions = array(/*'bcmath', */'pdo'); foreach ($extensions as $extension) { if (extension_loaded("$extension")) { //if (isset($setup['CLI'])) echo "$extension is loaded"; } else { die("***** FATAL ERROR: $extension was not found - please install before continuing *****\r\n"); } } // check if all required configuration variables are set $setup_check = $setup; foreach($optional_conf as $opt) unset($setup_check[$opt]); if ($conf == array_intersect($conf, array_keys($setup_check))) {} else { echo "***** FATAL ERROR: setup.conf has the following errors:\r\n"; $problems = array_diff($conf, (array_keys($setup_check))); if ($problems == $conf) { echo "***** You haven't set any values in setup.conf or you don't have permission to read it from this user. Please check that the settings for setup.conf are valid and your user has permission to read that file.\r\n"; } else { foreach ($problems as $prob) echo "***** $prob not set in setup.conf *****\r\n"; } } // setup database if ($setup["LOG_DIR"]) $setup["LOG_DIR"] .= "floexplorer_log"; if ($DB_TYPE == 'MYSQL') { if ($setup['CLI']) echo "setup attempting to connect to database... \r\n"; try { $dbh = new PDO("mysql:host=" . $setup['DB_HOST'] . ";dbport=" . $setup['DB_PORT'] . ";dbname=" . $setup['DB_NAME'], $setup['DB_USER'], $setup['DB_PASS'], array( PDO::ATTR_PERSISTENT => true )); } catch (PDOException $e) { die("Error connecting to database."); } } // create rpc_setup variables to pass into this class $rpc_setup = array( "RPC_USER" => $setup["RPC_USER"], "RPC_PASS" => $setup["RPC_PASS"], "RPC_HOST" => $setup["RPC_HOST"], "RPC_PORT" => $setup["RPC_PORT"] ); ?>