-require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
-require_once(CONST_BasePath.'/@script_source@');
+require('@CMAKE_SOURCE_DIR@/lib-php/dotenv_loader.php');
+
+@define('CONST_Default_ModulePath', '@CMAKE_BINARY_DIR@/module');
+@define('CONST_Default_Osm2pgsql', '@CMAKE_BINARY_DIR@/osm2pgsql/osm2pgsql');
+@define('CONST_DataDir', '@CMAKE_SOURCE_DIR@/data');
+@define('CONST_SqlDir', '@CMAKE_SOURCE_DIR@/lib-sql');
+@define('CONST_ConfigDir', '@CMAKE_SOURCE_DIR@/settings');
+
+loadDotEnv();
+$_SERVER['NOMINATIM_NOMINATIM_TOOL'] = '@CMAKE_BINARY_DIR@/nominatim';
+
+require_once('@CMAKE_SOURCE_DIR@/lib-php/admin/@script_source@');