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

- Thread: https://externals.io/message/31321
- Original archive: https://news-web.php.net/php.internals/31321
- Started by Nico Sabbi on 2007-07-30T10:25:34+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #31321 — Nico Sabbi — 2007-07-30T10:25:34+00:00

URL: https://externals.io/message/31321#31321

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

---

## #31332 — Richard Lynch — 2007-07-31T03:29:58+00:00

URL: https://externals.io/message/31321#31332 · In reply to: #31321

> $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?

---

## #31333 — Antony Dovgal — 2007-07-31T07:27:20+00:00

URL: https://externals.io/message/31321#31333 · In reply to: #31321

> 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
