PHP lacks any specific function to fsync on a file AFAIK. I do however feel the urge to fsync a logfile I am appending to from PHP.
Is there any native PHP function known to cause an fsync? Or any workaround?
I'm afraid it's not possible. The only reference to fsync
in the sources is in the implementation of the flush
operation for regular filesystem streams and it's just to explicitly say they're not fsyncing, only calling fflush
.
If you really need this, you have to do it in a PHP extension.
As of PHP 8.1 these methods are now available with the expected names.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With