Skip to content

max_execution_time counts wall time on ZTS builds, CPU time elsewhere #25499

Open

Description

@nicolas-grekas

Description

max_execution_time should mean the same thing whatever the build. Today it counts CPU time on Linux, as the manual says ("database queries, etc. is not included"), but wall time on builds with Zend Max Execution Timers, on by default for ZTS on Linux and FreeBSD, since #10141 switched from CPU time during review.

This caught us by surprise moving a Symfony app from FPM to FrankenPHP: with the same php.ini, requests waiting for the lock of their session file started dying at 10 seconds, where FPM never counted that wait. A build option shouldn't redefine a setting everybody shares an understanding of.

timer_create() accepts CLOCK_THREAD_CPUTIME_ID on Linux, so these timers could count the CPU time of their thread, as setitimer() does everywhere else. A wall-time limit has its uses, but as its own setting, as proposed in https://wiki.php.net/rfc/max_execution_wall_time, not as a different meaning of this one.

WDYT?

Activity

  1. NattyNarwhal commented on Nov 17, 2026

    @NattyNarwhal
    Member

    Note that some platforms can only do wall time regardless, it's a bit of a mess:

    #if defined(__CYGWIN__) || defined(__PASE__)

    Then you have hard timeout in NTS but not ZTS!

    FWIW, I think wall time probably makes more sense since it's easier to reason about with, and a lot of timeouts are going to be spent waiting on i.e. remote database servers, where you're waiting on reads/writes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions