当前位置: 首页 > Web与应用 > 正文
option Explicit
dim strComputer,objWMIService,objShell,colProcesses
strComputer = “.”
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
Set objShell = CreateObject(“Wscript.Shell”)

Do
        Set colProcesses = objWMIService.ExecQuery _
                (“Select * from Win32_Process Where Name = 'php-cgi.exe'”)

        '如果指定进程少于3个,就再添加一个进程
        If colProcesses.Count < 3 Then
                objShell.Run “RunHiddenConsole.exe  php\php-cgi.exe -b 127.0.0.1:9000 -c php\php.ini”
        End If

        '5秒检测一次
        Wscript.Sleep 5000

Loop

适合用于NGINX For WINDOWS上面,解决PHP-CGI.EXE经常挂掉的问题。

VBS 编写的PHP-CGI.EXE驻守程序:等您坐沙发呢!

发表评论