From af1c1231b6e33bedeb2c2a8b0e1700ae4d002f28 Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Fri, 26 Dec 2025 12:45:23 -0800 Subject: [PATCH] Fix PHP-FPM compatibility and add server diagnostics Changes to .htaccess: - Removed php_flag and php_value directives (don't work with php-fpm) - Simplified DirectoryMatch to FilesMatch for .json files - Added note about configuring PHP settings in php.ini/pool config - More compatible with user directories Added diagnostic.php: - Tests PHP version, extensions, and configuration - Checks storage directory permissions - Tests Server-Sent Events (SSE) connection - Shows server API type (php-fpm vs mod_php) - Provides troubleshooting hints for common issues - Live SSE connection test with detailed logging Added data/index.php: - Blocks direct access to data directory - Returns 403 Forbidden Fixes: - php-fpm environments not respecting .htaccess PHP settings - DirectoryMatch issues in user directories - Hard to diagnose connection problems Usage: Navigate to diagnostic.php to troubleshoot server issues --- server/php/.htaccess | 21 ++-- server/php/data/index.php | 5 + server/php/diagnostic.php | 205 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 219 insertions(+), 12 deletions(-) create mode 100644 server/php/data/index.php create mode 100644 server/php/diagnostic.php diff --git a/server/php/.htaccess b/server/php/.htaccess index 9e7981a..709dee9 100644 --- a/server/php/.htaccess +++ b/server/php/.htaccess @@ -1,22 +1,15 @@ # Security settings for Multi-User Transcription Server - -# Deny access to data directory - - Require all denied - +# Compatible with both mod_php and php-fpm # Deny access to config file directly (if accessed via URL) Require all denied -# Enable PHP error logging (disable display for production) -php_flag display_errors Off -php_flag log_errors On - -# Set upload limits -php_value upload_max_filesize 1M -php_value post_max_size 1M +# Deny access to .json data files + + Require all denied + # Disable directory listing Options -Indexes @@ -29,3 +22,7 @@ Options -Indexes # Set MIME types AddType application/json .json AddType text/event-stream .php + +# NOTE: PHP settings (display_errors, upload limits) must be configured in: +# - For php-fpm: /etc/php/X.X/fpm/pool.d/www.conf or php.ini +# - For mod_php: Can use php_flag/php_value directives here diff --git a/server/php/data/index.php b/server/php/data/index.php new file mode 100644 index 0000000..73eb43b --- /dev/null +++ b/server/php/data/index.php @@ -0,0 +1,5 @@ + + + + Server Diagnostic - Multi-User Transcription + + + + +

🔧 Server Diagnostic

+ + ='); + ?> +
+

PHP Version

+

+

Version:

+ +

Minimum required: PHP 7.4.0

+ +
+ + +
+

Server API

+

ℹ INFO

+

SAPI:

+

Type:

+ +

✓ Running under PHP-FPM. Note: php_flag/php_value directives in .htaccess won't work. Configure PHP settings in php.ini or FPM pool config.

+ +
+ + +
+

Storage Directory

+

+

Path:

+

Exists:

+

Writable:

+ +

Fix: Run: mkdir -p && chmod 755

+ +
+ + +
+

PHP Extensions

+

+ +

All required extensions loaded

+ +

Missing extensions:

+ +
+ + +
+

Server Information

+

ℹ INFO

+

Server:

+

Document Root:

+

Script Path:

+
+ + +
+

API Endpoint Test

+

ℹ INFO

+

Info endpoint: server.php?action=info

+

Test this endpoint to verify the API is accessible

+
+ + +
+

Server-Sent Events (SSE) Test

+

Testing...

+
Connecting to SSE endpoint...
+
+
+ +
+

Common Issues & Solutions

+ +
+ + + +