简体   繁体   中英

How to terminate the running command of PHP exec() launched?

I am using windows OS with wamp system installed.

My question is :

How to stop or terminate the running command of PHP exec() launched? In my situation,I will launch several command at the same time, and is it has something like IDs which corresponding,so I can stop the running command I want?

Thank you very much!!

I'm not sure if the same logic applies when using Windows OS, but you will want to do it in two steps.

1) When you launch the process from php - you'll need to fork, so that your actual PHP doesn't hang. I'm used to doing it in perl, i'm sure php does it too.

2) Whatever program you launch, if you can get its PID then store it in a database. If it's a unique executable name then just run taskkill /IM uniquename.exe or taskkill /PID #### if you have the PID

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM