Support hosts that disable fpassthru()
Cloudways disables fpassthru(), and some cursory research indicates that others such as Flywheel do as well.
I put this dreadful kludge in my cache-config.php but it might be nice if Surge detected and coped with a missing fpassthru():
function fpassthru($stream) {
echo stream_get_contents($stream);
}
Thanks @avdi! I'll look into this more.
I spoke with a few hosting providers that disabled fpassthru a couple of years ago and none of them had a good reason other than "probably because a similarly named passthru is disabled". Worth reaching out to support to ask about it and possibly enabling it, but I will definitely look into stream_get_contents to see if it's a good fit/alternative.
Thanks so much! My understanding is that stream_get_contents will never be as performant as fpassthru, so it's probably best to keep fpassthru as the default when it's available. But having the alternative would be nice!
I spoke with a few hosting providers that disabled
fpassthrua couple of years ago and none of them had a good reason other than "probably because a similarly namedpassthruis disabled". Worth reaching out to support to ask about it and possibly enabling it, but I will definitely look intostream_get_contentsto see if it's a good fit/alternative.