tags:

views:

70

answers:

2

Hello ,

I have a PHP script where I create a new process using proc_open().It executes for about 2 hrs, at the end I have a proc_close().

Sometimes I need to stop this process in the middle , how do I kill/signal it to stop and free up the resources in PHP

+2  A: 

You call proc_terminate().

soulmerge
+2  A: 

well firstly you could create a manual script that calls proc_close ( resource $process ) this would initally wait obviously for a response from the process or if you need to immediately terminate it you can call proc_terminate();

Neil Hickman
Do I need to do a fclose on the pipes before calling the proc_terminate ?
mithunmo
if you take a look at http://www.php.net/manual/en/function.proc-terminate.php#81353 this post... you shall see that all childs will need to be closed i believe.
Neil Hickman