setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Read SQL file $sqlFile = __DIR__ . '/../database/webgis_db.sql'; if (!file_exists($sqlFile)) { die("SQL file not found at: $sqlFile"); } $sql = file_get_contents($sqlFile); // Split into statements and execute $pdo->exec($sql); echo "Database imported successfully to $db at $host!"; } catch (PDOException $e) { echo "Connection failed: " . $e->getMessage() . "\n"; }