From 4ee9c029dcba5041adbb2205ff16a2a003825d0f Mon Sep 17 00:00:00 2001 From: Jage9 Date: Sun, 22 Feb 2026 02:48:22 -0500 Subject: [PATCH] Add temporary runtime logging to media proxy --- deploy/php/media_proxy.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/deploy/php/media_proxy.php b/deploy/php/media_proxy.php index 44ba49c..b46ebf3 100644 --- a/deploy/php/media_proxy.php +++ b/deploy/php/media_proxy.php @@ -12,6 +12,27 @@ * - Provides same-origin endpoint for browser playback. */ +ini_set('display_errors', '0'); +ini_set('log_errors', '1'); +ini_set('error_log', '/home/bestmidi/public_html/chgrid/media_proxy_error.log'); +error_reporting(E_ALL); + +function proxy_debug_log($message) +{ + $line = date('c') . ' ' . $message . PHP_EOL; + @file_put_contents('/home/bestmidi/public_html/chgrid/media_proxy_error.log', $line, FILE_APPEND); +} + +register_shutdown_function(function () { + $e = error_get_last(); + if (!$e) { + return; + } + proxy_debug_log('FATAL: ' . json_encode($e)); +}); + +proxy_debug_log('START method=' . (isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'unknown') . ' uri=' . (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '')); + function set_status($code) { $map = array( @@ -212,4 +233,3 @@ if ($cacheControl !== '') { if ($method !== 'HEAD') { echo $body; } -