diff --git a/Backend/setup.php b/Backend/setup.php index 46ff1f5..b99f69e 100644 --- a/Backend/setup.php +++ b/Backend/setup.php @@ -85,13 +85,12 @@ if(isset($_POST["dbSetup"])){ file_put_contents($conFilePath, json_encode($dbCon)); - require_once('../bootstrap.php'); try{ - $capsule->Connection()->getPdo(); + require_once('../bootstrap.php'); } catch (\Exception $e) { - http_response_code(400); file_put_contents($conFilePath, NULL); - echo json_encode(["message" => "Could not connect to the database. Please check your configuration. error:"]); + http_response_code(400); + echo json_encode(["message" => "Could not connect to the database. Please check your configuration. error:" . $e]); exit(); } require_once ('Database/databaseMigration.php'); diff --git a/bootstrap.php b/bootstrap.php index 1959089..b988801 100755 --- a/bootstrap.php +++ b/bootstrap.php @@ -6,3 +6,4 @@ $con = json_decode(file_get_contents('config/database.json', true), true); $capsule->addConnection($con); $capsule->setAsGlobal(); $capsule->bootEloquent(); +$capsule->Connection()->getPdo();