Includes backend API, public-v2 frontend, database migrations, Composer config, and deployment/implementation docs. Config files with credentials are excluded via .gitignore. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
51 lines
1.8 KiB
PHP
51 lines
1.8 KiB
PHP
<?php
|
|
header('Content-Type: text/plain');
|
|
|
|
echo "=== Database Connection Debug ===\n\n";
|
|
|
|
// Check if config exists
|
|
$configPath = __DIR__ . '/../config.php';
|
|
echo "1. Config file path: $configPath\n";
|
|
echo " Exists: " . (file_exists($configPath) ? "YES" : "NO") . "\n\n";
|
|
|
|
if (file_exists($configPath)) {
|
|
$config = require $configPath;
|
|
echo "2. Config loaded:\n";
|
|
echo " Host: " . $config['database']['host'] . "\n";
|
|
echo " Port: " . $config['database']['port'] . "\n";
|
|
echo " Database: " . $config['database']['dbname'] . "\n";
|
|
echo " User: " . $config['database']['user'] . "\n\n";
|
|
}
|
|
|
|
// Check PDO PostgreSQL
|
|
echo "3. PDO PostgreSQL extension:\n";
|
|
echo " Loaded: " . (extension_loaded('pdo_pgsql') ? "YES" : "NO") . "\n\n";
|
|
|
|
// Try direct connection
|
|
echo "4. Testing direct PDO connection...\n";
|
|
try {
|
|
$dsn = "pgsql:host=localhost;port=5437;dbname=ferrero_tracking";
|
|
$pdo = new PDO($dsn, 'ferrero_user', 'ferrero_pass_2025');
|
|
echo " ✅ Direct connection successful!\n\n";
|
|
|
|
// Test query
|
|
$stmt = $pdo->query("SELECT tracking_id, original_filename FROM master_assets WHERE tracking_id = 'rQ0Ijf'");
|
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if ($result) {
|
|
echo "5. Test query successful:\n";
|
|
echo " Tracking ID: " . $result['tracking_id'] . "\n";
|
|
echo " Filename: " . $result['original_filename'] . "\n";
|
|
} else {
|
|
echo "5. Test query returned no results\n";
|
|
}
|
|
|
|
} catch (PDOException $e) {
|
|
echo " ❌ Connection failed: " . $e->getMessage() . "\n";
|
|
echo " Error code: " . $e->getCode() . "\n";
|
|
}
|
|
|
|
echo "\n6. PHP Version: " . PHP_VERSION . "\n";
|
|
echo "7. Loaded extensions: " . implode(', ', array_filter(get_loaded_extensions(), function($ext) {
|
|
return strpos(strtolower($ext), 'pdo') !== false || strpos(strtolower($ext), 'pgsql') !== false;
|
|
})) . "\n";
|