You can write the variable into a file and “tail” that file on terminal.
function writelog($msg)
{
file_put_contents(FILE_PATH,$msg);
}
You can also use error_log function instead of file_put_content. But i am not sure whether its an error message or not.
On terminal just run
tail -f FILE_PATH
P.S. FILE_PATH is absoulte path of the file where you want to write the data.
1
solved PHP debuging printing into command line [closed]