Php code not working as expected - read contents of PDF

Permalink
Hello,
I'm trying to write a php script to display the contents of a PDF in a browser (on one of my concrete5 site pages). The code works when creating a php page outside of concrete5, but when I try to imbed the php script into a simple php block, it's displaying garbage.

My script is as follows:

<?php
header("Content-type: application/pdf");
header("Content-Disposition: inline; filename=example.pdf");
@readfile('/var/www/example.pdf');
?>

It's as if it's running the command from the commandline, and then displaying that garbage output, rather than loading the php script when the page loads which should at that time read the contents of the file. I've also tried to manually create a single php page based on the instructions herehttp://www.concrete5.org/documentation/developers/pages/single-page... which generates the same garbage output.

Any suggestions? Thanks for the help!