I have a PHP script that I want to run on the command line. This script, among other things, needs to load a PHP file that contains both PHP and HTML content and get the rendered output from that file.
This code does exactly what I need, but not when run from the command line:
<?php
// ...
if(file_exists($content_file)) {
ob_start();
include($content_file);
$content = ob_get_contents();
ob_end_clean();
}
?>
When run in the browser, my script gets the rendered output of the PHP file via include(), and stores the output in $content.
However, when I execute this script on the command line, the contents of the PHP file are echoed out, and $content never gets set.
I've searched the documentation, but nothing seems to work. Calling ini_set('implicit_flush', false) has no effect, nor does ob_implicit_flush(0);
Any thoughts?
I am unable to duplicate this problem using PHP 5.3.
And at the interactive prompt: