From d176eb2ec5e44f05a215cd92d36b814f8f064f3a Mon Sep 17 00:00:00 2001 From: luptmoor Date: Wed, 15 Apr 2026 10:38:14 +0200 Subject: [PATCH] connection to postgis with env vars --- index.php | 67 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 16 deletions(-) diff --git a/index.php b/index.php index 097c521..66f7713 100644 --- a/index.php +++ b/index.php @@ -1,21 +1,56 @@ 🌍 WebGIS Subdomain is Live!"; -echo "

Current Server: " . $_SERVER['SERVER_NAME'] . "

"; -echo "

PHP Version: " . phpversion() . "

"; +try { + $dsn = "pgsql:host=$host;port=5432;dbname=$db;"; + $pdo = new PDO($dsn, $user, $pass, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); -// Check for common GIS extensions (optional but helpful) -$extensions = ['gd', 'intl', 'bcmath', 'pdo_pgsql']; -echo "

GIS Extension Check:

"; - -echo "
"; -echo "

If you see this, your Nginx → PHP-FPM bridge is working perfectly over HTTPS.

"; ?> + + + + + + PDO::ERRMODE_EXCEPTION, + // PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + // PDO::ATTR_EMULATE_PREPARES => false + // ]; + + + // $dsn = "pgsql:host=localhost;dbname=getenv('POSTGRES_DB');port=5432"; + // $pdo = new PDO($dsn, getenv('POSTGRES_USER'), 'getenv('POSTGRES_PASSWORD'), $opt); + + + // } catch(PDOException $e) { + // echo "Error: ".$e->getMessage(); + // } +?> +