41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
|
<?php
|
||
|
// Debug version of LiteSpeed check
|
||
|
error_reporting(E_ALL);
|
||
|
ini_set('display_errors', 1);
|
||
|
|
||
|
echo "=== LiteSpeed Debug Script ===\n";
|
||
|
echo "PHP Version: " . phpversion() . "\n";
|
||
|
echo "Script started...\n";
|
||
|
|
||
|
// Test basic function
|
||
|
function test_command($cmd) {
|
||
|
echo "Testing command: $cmd\n";
|
||
|
$output = [];
|
||
|
$return_var = 0;
|
||
|
exec($cmd . ' 2>&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";
|
||
|
?>
|