How to get list of running php scripts using PHP exec()?

前端 未结 4 1207

I need to know and kill if there is any processes running a specified PHP script. Is that possible to get list of processes running sample.php using exec() and a php script.

4条回答
  •  情话喂你
    2020-12-17 04:16

    exec("ps auxwww|grep sample.php|grep -v grep", $output);
    

    This would only work, though, if PHP is running in CGI mode. If it's running as a SAPI type thing, you'll never see "sample.php" in the process list, just 'httpd'.

提交回复
热议问题