Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

  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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top