Closed as not planned
Closed as not planned
Description
Description
The following code:
<?php
sleep(6000);
echo("hi");
Resulted in this output:
hi
But I expected this output instead:
Maximum execution time of <x> exceeded
While this is a documented limitation, I would like to argue that this should be reimplemented to match the windows implementation where it tracks the real time of the script.
- Max execution time being based on PHP's CPU time is unintuitive. When you set max execution time, nobody expects it to be PHP CPU time, making this an easy to trap where you think you've set yourself up to be safe against long running requests, and instead are still exposed to this failure mode.
- This behavior should be OS consistent. Having it inconsistent adds to operational confusion when working with PHP.
- If the expectation is that the SAPI be the one to handle "real" max execution time, then one of the oldest simplest SAPIs (apache's mod_php) does not have a way to handle this, and PHP CLI applications will be left in the dust, as they have no comparable way to manage max execution time.
- Max execution time being based on CPU time is not useful. If a request is running for 5+ minutes, I don't care if it's sleeping, stuck in a bad recursive loop, waiting on a bad mysql query, or stuck on a curl that won't resolve, I just need it to end and free up resources. Without this, I've seen requests that have lifespans of days or weeks because they've gotten stuck in novel places without a timeout.
PHP Version
7.4
Operating System
Not-windows