简体   繁体   中英

PHP, kill Windows process?

Is there a way to kill a Windows process, say calc.exe , with PHP without using exec ?

exec calls an external program, I try to avoid using that command unless necessary.

There is.

Use the W32api PHP extension, which provides access to the Win32 API - then use the TerminateProcess() API after aquiring a handle to the process.

  1. define new function in PHP sources ( pure C )
  2. compile you new PHP version with the defined function
  3. call the new function, which was defined in PHP sources by you

PS

On this way you are able to make PHP able work with __asm { } insertions/add some kernel code , if you want it...

No, there isn't. PHP has little access to the system except through exec .

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