AbydosGater Posted December 22, 2007 Share Posted December 22, 2007 Hey guys, I was to run a small script but its an infinite while loop so i cant do it in the browser. I plan on using exec() to run it.. But then if i want to stop it.. how would i stop the script? Is there a different function i could use to kill the process? Andy Quote Link to comment https://forums.phpfreaks.com/topic/82835-ending-an-execed-script/ Share on other sites More sharing options...
The Little Guy Posted December 22, 2007 Share Posted December 22, 2007 http://php.net/set_time_limit() Quote Link to comment https://forums.phpfreaks.com/topic/82835-ending-an-execed-script/#findComment-421279 Share on other sites More sharing options...
AbydosGater Posted December 22, 2007 Author Share Posted December 22, 2007 Thanks for the link, But i dont want to set a time limit on it.. I was wondering if i could have a different php script that when ran would kill the exec()'ed script? So i can end it when i want, not on a time limit. Andy Quote Link to comment https://forums.phpfreaks.com/topic/82835-ending-an-execed-script/#findComment-421282 Share on other sites More sharing options...
The Little Guy Posted December 22, 2007 Share Posted December 22, 2007 AJAX Quote Link to comment https://forums.phpfreaks.com/topic/82835-ending-an-execed-script/#findComment-421313 Share on other sites More sharing options...
trq Posted December 23, 2007 Share Posted December 23, 2007 You'll want to find the pid of the script running and kill that. Quote Link to comment https://forums.phpfreaks.com/topic/82835-ending-an-execed-script/#findComment-421425 Share on other sites More sharing options...
PHP_PhREEEk Posted December 23, 2007 Share Posted December 23, 2007 If you're running it through shell, I've had great success using a screen instance. When you kill the screen, the script will die too. Works great for me... I do a lot of these things all the time. PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/82835-ending-an-execed-script/#findComment-421428 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.