test message for postgis connect
This commit is contained in:
36
index.php
36
index.php
@@ -1,21 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* WebGIS Connectivity Test
|
||||
*/
|
||||
$host = 'webgis-db'; // Matches the service name in docker-compose
|
||||
$db = 'webgis-db';
|
||||
$user = 'webgis-db-admin';
|
||||
$pass = 'endex-webgis';
|
||||
|
||||
echo "<h1>🌍 WebGIS Subdomain is Live!</h1>";
|
||||
echo "<p><strong>Current Server:</strong> " . $_SERVER['SERVER_NAME'] . "</p>";
|
||||
echo "<p><strong>PHP Version:</strong> " . phpversion() . "</p>";
|
||||
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 "<h3>GIS Extension Check:</h3><ul>";
|
||||
foreach ($extensions as $ext) {
|
||||
$status = extension_loaded($ext) ? "✅ Loaded" : "❌ Not Found";
|
||||
echo "<li>$ext: $status</li>";
|
||||
if ($pdo) {
|
||||
echo "<h1>✅ Connected to PostGIS!</h1>";
|
||||
|
||||
// Check PostGIS version
|
||||
$query = $pdo->query("SELECT PostGIS_full_version();");
|
||||
$version = $query->fetch();
|
||||
echo "<p><strong>PostGIS Version:</strong> " . $version[0] . "</p>";
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<h1>❌ Connection Failed</h1>";
|
||||
echo "<p>" . $e->getMessage() . "</p>";
|
||||
}
|
||||
echo "</ul>";
|
||||
|
||||
echo "<hr>";
|
||||
echo "<p>If you see this, your Nginx → PHP-FPM bridge is working perfectly over HTTPS.</p>";
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user