I am trying to serve a WOFF font file in PHP.
First I set the Content-Type header:
header("Content-Type: application/font-woff");
Then I try the following:
This works fine (the file is properly served to the user, and the Content-Length header matches the file size):
readfile("path/to/font.woff");
But this doesn't (the script completes without error, but I receive an "octet stream" error in the browser, and the Content-Length header is 0):
echo file_get_contents("path/to/font.woff");
Why am I receiving an error using file_get_contents? I am using Windows 10, IIS Express 10, and PHP 7.2