Rebel7284 Posted October 21, 2008 Share Posted October 21, 2008 Hi, I have a problem with signal handling not working in cli PHP Relevant information: PHP 4.3.11 (cli) (built: Jun 21 2005 12:10:12) Cent OS kernel 2.6.9 Sample code: <? //declare(ticks = 1); pcntl_signal(SIGINT, "sighandler"); pcntl_signal(SIGQUIT, "sighandler"); function sighandler($signo){ echo "Got ", $signo; //ob_end_flush(); } while(1){ sleep(5); } ?> With this code running, I can press Ctrl-C and Ctrl-\ as much as I want, it ignores it and just sits there. If I uncomment the ticks line, the signals are simply not handled and result in immediate script termination. Does anyone have any idea what I'm doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/129397-problem-with-signals/ Share on other sites More sharing options...
trq Posted October 21, 2008 Share Posted October 21, 2008 Is the process control extension installed? Is error reporting enabled? Any errors? Quote Link to comment https://forums.phpfreaks.com/topic/129397-problem-with-signals/#findComment-670831 Share on other sites More sharing options...
Rebel7284 Posted October 21, 2008 Author Share Posted October 21, 2008 Is the process control extension installed? Huh? Since when is it an extension? I was under impression that it was a core part of PHP. Where in php.ini would i find this out? Is error reporting enabled? Any errors? Warnings and higher are enabled. No errors are being displayed. Quote Link to comment https://forums.phpfreaks.com/topic/129397-problem-with-signals/#findComment-670840 Share on other sites More sharing options...
trq Posted October 21, 2008 Share Posted October 21, 2008 Huh? Since when is it an extension? Read here. Where in php.ini would i find this out? There is no runtime configuration. Id check with phpinfo(); Quote Link to comment https://forums.phpfreaks.com/topic/129397-problem-with-signals/#findComment-670842 Share on other sites More sharing options...
Rebel7284 Posted October 21, 2008 Author Share Posted October 21, 2008 but pcntl_fork works. If it was a problem with the extension, that wouldn't work either, right? Edit: just looked in phpinfo, --enable-pcntl is there. Quote Link to comment https://forums.phpfreaks.com/topic/129397-problem-with-signals/#findComment-670845 Share on other sites More sharing options...
Rebel7284 Posted October 21, 2008 Author Share Posted October 21, 2008 bump Quote Link to comment https://forums.phpfreaks.com/topic/129397-problem-with-signals/#findComment-671033 Share on other sites More sharing options...
Rebel7284 Posted October 21, 2008 Author Share Posted October 21, 2008 bump2, has no one here worked with signals before? Quote Link to comment https://forums.phpfreaks.com/topic/129397-problem-with-signals/#findComment-671202 Share on other sites More sharing options...
trq Posted October 21, 2008 Share Posted October 21, 2008 I'm at home now and have tested your script. Works as expected from here. Hitting Ctrl-C then Ctrl-\ produces.... Got 2Got3 Quote Link to comment https://forums.phpfreaks.com/topic/129397-problem-with-signals/#findComment-671209 Share on other sites More sharing options...
Rebel7284 Posted October 21, 2008 Author Share Posted October 21, 2008 I'm at home now and have tested your script. Works as expected from here. Hitting Ctrl-C then Ctrl-\ produces.... Got 2Got3 This makes no sense to me. Any idea what can possibly be interfering with this? Quote Link to comment https://forums.phpfreaks.com/topic/129397-problem-with-signals/#findComment-671219 Share on other sites More sharing options...
DarkWater Posted October 21, 2008 Share Posted October 21, 2008 I really want to say that your really old PHP version has something to do with it, but I can't be sure. Quote Link to comment https://forums.phpfreaks.com/topic/129397-problem-with-signals/#findComment-671257 Share on other sites More sharing options...
Rebel7284 Posted October 22, 2008 Author Share Posted October 22, 2008 One more bump just in case anyone else has any idea on what I can try to do to figure out the root of this problem. Quote Link to comment https://forums.phpfreaks.com/topic/129397-problem-with-signals/#findComment-672169 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.