I migrated to a new server and I've enabled PHP-FPM. On the old server, we used to use suphp and we could flush() a byte in PHP whenever we wanted. On the new server with PHP-FPM, I found out yesterday that some PHP scripts flushing just a byte or two at a time seemed to be broken. After investigating, I found out that they are not broken, but that the default configuration that comes with EA4 PHP 8.2 under PHP-FPM is to buffer at least 8KB of DATA before flushing to the browser. This is unacceptable for applications where only a handful of or even a single byte is flushed periodically. Think of a progress monitor, you know with the "." piling up while a background process is working. With how PHP-FPM is right now, it would take 8000 seconds for 8000 dots to finally be flushed to the browser all at once instead of 1 dot per second!
I dug around on the internet and aside from the obviously overkill solution of always flushing at least 8KB of DATA every single time, I found that apparently, it could probably work if I disabled buffering with this Apache directive, but I don't know where to set it not to break WHM or have WHM undo my changes at some point in the future.
Any idea where I could put this and/or other genius ideas on how to completely disable the 8KB buffer in PHP-FPM on WHM? I'm using Apache 2.4.58 which comes with WHM 116.0.9.
Please sign in to leave a comment.