Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/129397-problem-with-signals/
Share on other sites

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.

 

 

Link to comment
https://forums.phpfreaks.com/topic/129397-problem-with-signals/#findComment-670840
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.