surge icon indicating copy to clipboard operation
surge copied to clipboard

Support hosts that disable fpassthru()

Open avdi opened this issue 1 year ago • 2 comments

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);
}

avdi avatar Jul 18 '24 17:07 avdi

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.

kovshenin avatar Sep 05 '24 11:09 kovshenin

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 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.

avdi avatar Sep 05 '24 15:09 avdi