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.
There isn't. Because PHP is ran through apache/nginx. In case of command-line-access, proccess is named PHP, not actual name of your script.