&1', $output, $return_var); echo "Return code: $return_var\n"; echo "Output: " . implode("\n", $output) . "\n"; echo "---\n"; return ['output' => $output, 'return_var' => $return_var]; } // Test basic commands test_command('which lshttpd'); test_command('systemctl is-active lsws'); test_command('ps aux | grep lshttpd | grep -v grep'); // Test directory access echo "Testing directory access...\n"; $test_dirs = ['/opt/litespeed', '/opt/lsws', '/usr/local/lsws']; foreach ($test_dirs as $dir) { echo "Directory $dir: " . (is_dir($dir) ? "EXISTS" : "NOT FOUND") . "\n"; } // Test JSON output echo "Testing JSON output...\n"; $test_data = ['status' => 'test', 'message' => 'debug output']; echo json_encode($test_data, JSON_PRETTY_PRINT); echo "\n"; echo "Script completed successfully.\n"; ?>