Not running'; } else{ $html = '
Running
'; $header = "\n"; $row = "\n"; foreach ($status as $column => $value) { $header .= ""; $row .= ""; } $header .= "\n"; $row .= "\n"; $html .= $header . $row ."
$column$value
"; return $html; } } function isWin(){ return (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'); } function get_process_sig(){ global $config; if(isWin()){ return $config['p_sig']; } else{ return '[' . substr($config['p_sig'],0,1) . ']' . substr($config['p_sig'],1); } } function is_running(){ global $config; if (isWin()) { $command = 'WMIC PROCESS WHERE "Caption=\'php.exe\'" get Commandline, Processid, Status, UserModeTime, VirtualSize |findstr ' . get_process_sig(); } else { $command = "ps aux | grep " . get_process_sig(); } $result = shell_exec($command); $result = preg_replace('!\s+!', ' ', $result); $result = trim($result); if(!$result || $result == ""){ return false; } $resultArr = explode(" ",$result); if (isWin()) { $columns = array('Caption','Commandline','PID','UserModeTime','VirtualSize'); } else { $columns = array("USER","PID","%CPU","%MEM","VSZ","RSS","TTY","STAT","START","TIME","COMMAND"); } $status = array(); foreach ($columns as $index => $column) { $status[$column] = $resultArr[$index]; } return $status; } function get_log_path(){ global $config, $logConfig; if($logConfig['status'] == 'ok' || ($logConfig['status'] == 'no_exist' && $logConfig['dir_writable'])){ return $logConfig['path']; } return null; } function log_status(){ global $config, $logConfig; if(!isset($config['log_file']) || $config['log_file'] == ''){ $logConfig['status'] = 'disabled'; return false; } $logConfig['path'] = __DIR__ . DIRECTORY_SEPARATOR . $config['log_file']; if(!file_exists($logConfig['path'])){ $logConfig['status'] = 'no_exist'; } else{ $logConfig['path'] = realpath(__DIR__ . DIRECTORY_SEPARATOR . $config['log_file']); if(is_writable($logConfig['path'])){ $logConfig['status'] = 'ok'; } else{ $logConfig['status'] = 'no_writable'; } } $logConfig['dir'] = dirname($logConfig['path']); $logConfig['dir_writable'] = is_writeable($logConfig['dir']); } function spawnProcess($command, $logFile = null) { if (isWin()) { if(isset($logFile)){ $logFile = '"' . $logFile . '"'; } else{ $logFile = 'NUL'; } $pcommand = 'start /B ' . $command . ' >> ' . $logFile . ' 2>>&1'; //echo $pcommand; die(); shell_exec($pcommand); } else { if(!isset($logFile)){ $logFile = '/dev/null'; } else{ $logFile = '"' . $logFile . '"'; } $pcommand = $command . ' >> ' . $logFile . ' 2>>' . $logFile .' &'; //echo $pcommand; die(); pclose(popen($pcommand, 'r')); } } function functions_enabled(){ return function_exists('shell_exec') && function_exists('popen') && function_exists('pclose'); } /** * Redirect to a page * * @param string $message * @param string $url */ function redirect($message = '', $url = 'index.php'){ //wait a bit for php to start sleep(3); if($message != ''){ $url .= '?message=' . urlencode($message); } header("Location: $url"); die(); } $logConfig = array(); log_status(); $action = isset($_REQUEST['action'])?$_REQUEST['action']:'index'; $methodName = 'action_' . $action; if(!function_exists($methodName)){ $action = 'index'; $methodName = 'action_index'; } $status = is_running(); $result = $methodName(); $functionsEnabled = functions_enabled(); ?> Magnoliyan Video Chat Commander

Magnoliyan Video Chat Commander

Functions shell_exec, popen, pclose are not enabled in php.ini. Either enable them or use command line to run websocket server.
Websocket parameters

Log file

Log file is not writable
Log directory is not writable