38458-vm/find_region.php
2026-02-15 21:32:26 +00:00

30 lines
944 B
PHP

<?php
require_once __DIR__ . '/db/config.php';
$regions = [
'us-east-1', 'us-east-2', 'us-west-1', 'us-west-2',
'ap-southeast-1', 'ap-southeast-2', 'ap-northeast-1', 'ap-northeast-2',
'eu-central-1', 'eu-west-1', 'eu-west-2', 'eu-west-3',
'sa-east-1', 'ca-central-1', 'me-south-1', 'af-south-1'
];
$pass = 'gA82h8K80T5QUAwi';
$projectRef = 'siqeqnizegizxemrfgkf';
foreach ($regions as $region) {
$host = "aws-0-$region.pooler.supabase.com";
$user = "postgres.$projectRef";
echo "Testing $region ($host)... ";
try {
$dsn = "pgsql:host=$host;port=6543;dbname=postgres;connect_timeout=5";
$pdo = new PDO($dsn, $user, $pass);
echo "SUCCESS!\n";
exit(0);
} catch (Exception $e) {
if (strpos($e->getMessage(), 'Tenant or user not found') !== false) {
echo "Not here.\n";
} else {
echo "Error: " . $e->getMessage() . "\n";
}
}
}