- Move 45 debug/test files from root to organized scripts/ directories - Secure public/ directory by removing debug files (security improvement) - Create structured scripts organization: • scripts/debug/ (20 files) - Framework debugging tools • scripts/test/ (18 files) - Test and validation scripts • scripts/maintenance/ (5 files) - Maintenance utilities • scripts/dev/ (2 files) - Development tools Security improvements: - Removed all debug/test files from public/ directory - Only production files remain: index.php, health.php Root directory cleanup: - Reduced from 47 to 2 PHP files in root - Only essential production files: console.php, worker.php This improves: ✅ Security (no debug code in public/) ✅ Organization (clear separation of concerns) ✅ Maintainability (easy to find and manage scripts) ✅ Professional structure (clean root directory)
42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
require __DIR__ . '/vendor/autoload.php';
|
|
|
|
// Test if the issue is specifically in web context
|
|
// by accessing localhost directly
|
|
echo "Testing localhost web request...\n";
|
|
|
|
$context = [
|
|
'http' => [
|
|
'method' => 'GET',
|
|
'header' => [
|
|
'User-Agent: Mozilla/5.0 (compatible test)',
|
|
'Host: localhost'
|
|
],
|
|
'ignore_errors' => true
|
|
],
|
|
'ssl' => [
|
|
'verify_peer' => false,
|
|
'verify_peer_name' => false
|
|
]
|
|
];
|
|
|
|
$response = @file_get_contents('https://localhost/', false, stream_context_create($context));
|
|
|
|
if ($response === false) {
|
|
$error = error_get_last();
|
|
echo "Failed to fetch localhost: " . $error['message'] . "\n";
|
|
|
|
// Try HTTP instead
|
|
echo "Trying HTTP instead of HTTPS...\n";
|
|
$response = @file_get_contents('http://localhost/', false, stream_context_create($context));
|
|
|
|
if ($response === false) {
|
|
echo "HTTP also failed\n";
|
|
} else {
|
|
echo "HTTP response length: " . strlen($response) . "\n";
|
|
echo "Response snippet: " . substr($response, 0, 200) . "\n";
|
|
}
|
|
} else {
|
|
echo "Response length: " . strlen($response) . "\n";
|
|
echo "Response snippet: " . substr($response, 0, 200) . "\n";
|
|
} |