Printing / Echoing To Console from PHP Script

php

Solution

Thats the method of doing it.

Things to check for are output buffering http://php.net/manual/en/function.ob-flush.php

Is that code actually being run ? Make sure it doesnt branch before it gets there

Problem

I'm debugging a PHP script that runs a couple SQL queries and emails a set of users. I'm sure this is a very basic thing, but every time I try to echo, print, or print_r it doesn't appear while running the script. So say I have this in the script: ``` print("This should print"); echo "on the command line"; ``` When I run the script via command line `php script.php` it doesn't actually print anything to the command line while running the script. Is there a way of having PHP print to console? I feel like I'm missing something extremely basic here.

Original source

Related problems