I have a php page that when called from a browser displays a page, it also generates a static html page so – http://somewebsite/create.php when run from a browser creates newpage.html.
I also run this page from the CLI #php create.php it creates newpage.html but I get all the output on the screen, this slows down execution and if I have to run it many times can take hours.
Is there a way to run #php create.php and to supress all output to the screen
MArtyn
You can pipe the output on the command-line to /dev/null such as:
php http://somewebsite/create.php > /dev/nullThis doesn’t actually stop output from being produced by php, only from being displayed.
If you actually want to stop the output from being produced, you could use php’s output buffering with ob_start() and put the output into a variable with ob_get_flush() at the end of the code and only echo the output if a certain param is/is not passed to the script.