In PHP, when a script consumes more memory_limit, the script stops with an error. How to add a warning level: if my script consumes more than 90 MB, do I have a warning in the log file, but the script continues and still crashes if it consumes more than 128 MB?
I don't know anything about PHP extensions or PHP code, but while we are already building PHP on our own, we can even fix the code.
In Zend / zend_alloc.c, I see this
if (segment_size < true_size || heap->real_size + segment_size > heap->limit) {
It is really easy to add a line before this and compare the used memory with a different limit and issue a warning.
Can I do this in an extension or by fixing PHP code? Why does this not yet exist? It is a bad idea? Does it already exist somewhere?
Adding the same warning to MAX_EXECUTION_TIME seems more complicated as I still don't understand how the timer is handled.
source
share