pcntl_alarm() doesn't work with apache_worker (multithreaded)

php.internals

Nico Sabbi

19 years ago
Hi, $subject says everything: when php runs under a multithreaded apache pcntl_alarm() doesn't work: the alarm is never delivered. My version of php is 5.2.3, but also all versions I tried of 5.1 work the same. Nico

Richard Lynch

19 years ago
On Mon, July 30, 2007 5:25 am, Nico Sabbi wrote:
> $subject says everything: when php runs under a multithreaded apache > pcntl_alarm() doesn't work: the alarm is never delivered. > > My version of php is 5.2.3, but also all versions I tried of 5.1 work > the same.
http://us2.php.net/manual/en/ref.pcntl.php "Process Control should not be enabled within a web server environment and unexpected results may happen if any Process Control functions are used within a web server environment." Don't do that. :-) It *MIGHT* happen to work in a non-multi-threaded web environment, but I wouldn't count on it as it's pretty clearly documented not to. YMMV
-- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

Antony Dovgal

19 years ago
On 30.07.2007 14:25, Nico Sabbi wrote:
> Hi, > $subject says everything: when php runs under a multithreaded apache > pcntl_alarm() doesn't work: the alarm is never delivered.
That's pretty much expected since your web-server is multithreaded, while "alarm() arranges for a SIGALRM signal to be delivered to the **process** in seconds seconds." (c) man alarm
> My version of php is 5.2.3, but also all versions I tried of 5.1 work > the same. > > Nico >
-- Wbr, Antony Dovgal