# max_execution_time - ITIMER_REAL vs ITIMER_PROF

- Thread: https://externals.io/message/28672
- Original archive: https://news-web.php.net/php.internals/28672
- Started by David Sklar on 2007-04-04T09:55:56+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #28672 — David Sklar — 2007-04-04T09:55:56+00:00

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

I'm interested in having a timeout that corresponds to clock time as
opposed to PHP execution time (the current behavior of
max_execution_time). A cursory scan of the source implies that (on
Unix at least) something that behaves like zend_set_timeout() but uses
setitimer()'s ITIMER_REAL timer instead of ITIMER_PROF would do the
trick. Before I investigate much further, a few questions:

- Is anyone aware of a reason why ITIMER_REAL would cause problems?
(Signal delivered while PHP is doing something uninterruptable?)
- Assuming ITIMER_REAL works OK, is there interest in incorporating a
patch for a "max_real_time" config directive / timeout?

Thanks,
David

---

## #28725 — Stanislav Malyshev — 2007-04-10T20:14:36+00:00

URL: https://externals.io/message/28672#28725 · In reply to: #28672

> I'm interested in having a timeout that corresponds to clock time as
> opposed to PHP execution time (the current behavior of
> max_execution_time). A cursory scan of the source implies that (on
> Unix at least) something that behaves like zend_set_timeout() but uses
> setitimer()'s ITIMER_REAL timer instead of ITIMER_PROF would do the
> trick. Before I investigate much further, a few questions:
> 
> - Is anyone aware of a reason why ITIMER_REAL would cause problems?

IIRC at least on some systems ITIMER_REAL is the same as alarm(), and 
Apache uses alarm(), so we might have a conflict there.

-- 
Stanislav Malyshev, Zend Products Engineer
stas@zend.com  http://www.zend.com/
