0

I am debugging a PHP website.
When an error occurs or I want to print debug info, this text will be send to the browser.

I know that you can do something like this to show the text in the browser console:

echo "<script>console.log('An error occurred')</script>";

Or you can do this to show the text in the browser window:

echo "<pre>An error occurred</pre>";

But what I would like (which I am used to in Node.js) is to see the text occur in the server console.

Is there any way to write output to the server command line (where Apache is running) instead of to the browser?
Preferably normal "echo" command would still output to the browser, but this special command would output to the server command line.

Something like this:

// echo to the commandline of the server (Doesn't work. This is what I want to work)
process->stdout->write('Error for the backend programmer');

// echo to the browser (does work)
echo 'Error for the browser';
6

0

Browse other questions tagged or ask your own question.