- config_loader.php: prefer local billing config FIRST (root cause fix) - was: panel config loaded first, overriding local config with wrong db name - now: local modules/billing/includes/config.inc.php always wins when present - config.inc.php: add $db_port="3306" - config.example.php: new example config with all variables documented - menu.php: add $db_port to mysqli_connect - admin_auth.php: add $db_port; remove hardcoded /_website path detection - bootstrap.php billing_get_db(): add $db_port - login.php: fix /_website path detection - adminserverlist.php: add $db_port; fix hardcoded /modules/billing/ URL - All other mysqli_connect calls: add isset($db_port) port parameter (my_servers, forgot_password, serverlist, server_status, order, register, reset_password, payment_success, my_account, admin_invoices, admin_payments, diag_remote, admin_coupons, test_db_connection, tools/check_db_user, renew_server) - timestamp.txt: updated Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/a3e1e4bb-8eb1-4e6e-b1f8-7f3952301231 Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
77 lines
3.8 KiB
PHP
77 lines
3.8 KiB
PHP
<?php
|
|
// Remote diagnostic helper for GameServers.World (_website)
|
|
// Upload this file to the remote server and open it in the browser to collect environment info.
|
|
header('Content-Type: text/plain; charset=utf-8');
|
|
echo "GSP _website remote diagnostic\n";
|
|
echo "Date: " . date('c') . "\n\n";
|
|
|
|
// PHP info summary
|
|
echo "PHP Version: " . PHP_VERSION . "\n";
|
|
echo "Loaded extensions: " . implode(', ', get_loaded_extensions()) . "\n\n";
|
|
|
|
// Session settings
|
|
echo "Session save path: " . (ini_get('session.save_path') ?: '(not set)') . "\n";
|
|
echo "Session cookie params: " . json_encode(session_get_cookie_params()) . "\n";
|
|
echo "Session status (before start): " . session_status() . "\n";
|
|
|
|
// Try to start a named session used by _website
|
|
session_name('opengamepanel_web');
|
|
@session_start();
|
|
echo "Session status (after start): " . session_status() . "\n";
|
|
echo "Session id: " . session_id() . "\n";
|
|
echo "Session variables: \n" . print_r($_SESSION, true) . "\n";
|
|
|
|
// Check config file readability (panel root first, module local second)
|
|
$panelCfgRoot = realpath(__DIR__ . '/../../..');
|
|
$panelCfg = $panelCfgRoot ? $panelCfgRoot . '/includes/config.inc.php' : __DIR__ . '/../../..' . '/includes/config.inc.php';
|
|
$localCfg = __DIR__ . '/includes/config.inc.php';
|
|
echo "Panel config: " . $panelCfg . " exists=" . (file_exists($panelCfg) ? 'yes' : 'no') . " readable=" . (is_readable($panelCfg) ? 'yes' : 'no') . "\n";
|
|
echo "Local config: " . $localCfg . " exists=" . (file_exists($localCfg) ? 'yes' : 'no') . " readable=" . (is_readable($localCfg) ? 'yes' : 'no') . "\n";
|
|
|
|
require_once(__DIR__ . '/includes/config_loader.php');
|
|
echo "Active config source: " . (defined('BILLING_CONFIG_PATH') ? BILLING_CONFIG_PATH : '(unknown)') . "\n";
|
|
if (defined('BILLING_CONFIG_PATH') && is_readable(BILLING_CONFIG_PATH)) {
|
|
echo "Active config preview (first 200 chars):\n" . substr(file_get_contents(BILLING_CONFIG_PATH), 0, 200) . "\n";
|
|
}
|
|
|
|
echo "Trying DB connection...\n";
|
|
$ok = false;
|
|
if (isset($db_host)) {
|
|
$db = @mysqli_connect($db_host, $db_user, $db_pass, $db_name, isset($db_port) ? (int)$db_port : null);
|
|
if ($db) {
|
|
echo "DB connect: OK (host=$db_host db=$db_name)\n";
|
|
$ok = true;
|
|
// run a small query
|
|
$q = @mysqli_query($db, "SELECT COUNT(*) AS cnt FROM information_schema.tables WHERE table_schema = '".mysqli_real_escape_string($db,$db_name)."'");
|
|
if ($q) {
|
|
$r = mysqli_fetch_assoc($q);
|
|
echo "Tables in DB: " . ($r['cnt'] ?? 'unknown') . "\n";
|
|
}
|
|
mysqli_close($db);
|
|
} else {
|
|
echo "DB connect: FAILED (mysqli_connect_error: " . mysqli_connect_error() . ")\n";
|
|
}
|
|
} else {
|
|
echo "DB config not available to attempt connection.\n";
|
|
}
|
|
|
|
// Check data and logs directories
|
|
$data = realpath(__DIR__ . '/..') . DIRECTORY_SEPARATOR . 'data';
|
|
$logs = __DIR__ . DIRECTORY_SEPARATOR . 'logs';
|
|
echo "Site data dir: $data exists=" . (is_dir($data)?'yes':'no') . " writable=" . (is_writable($data)?'yes':'no') . "\n";
|
|
echo "Site logs dir: $logs exists=" . (is_dir($logs)?'yes':'no') . " writable=" . (is_writable($logs)?'yes':'no') . "\n";
|
|
|
|
// Try creating test files
|
|
if (is_dir($logs) && is_writable($logs)) {
|
|
$fn = $logs . DIRECTORY_SEPARATOR . date('Y-m-d') . '.diag.txt';
|
|
$w = @file_put_contents($fn, "diag " . date('c') . "\n", FILE_APPEND);
|
|
echo "Wrote diag file to $fn result=" . ($w ? 'ok' : 'fail') . "\n";
|
|
}
|
|
|
|
echo "\nSuggested next checks:\n";
|
|
echo " - Confirm PHP can write session files to session.save_path and that cookies are sent to browser (use browser devtools).\n";
|
|
echo " - Ensure the site path is served under the expected /_website/ path and that session cookie domain/path match the served path.\n";
|
|
echo " - If sessions aren't persistent across requests, check webserver user permissions and session.save_path.\n";
|
|
|
|
?>
|
|
|