Reputation: 21150
I'm running a large scraper script and I have some echo "$this is happening"
calls set up ont he page to help me do debugging.
I'd like these messages to show up as they're written, rather than at the end of the 20-minute scrape because, obviously, if things go wrong I don't want to wait so long to know about them.
I've tried setting output_buffering = off
in php.ini
, as well as implicit_flush = on
. In my script, I've put flush();
after every echo
call, but to no avail.
What's the correct way to do this? When I load the script it's currently going to an invisible page (that is, my php script's tab shows whatever was on the last tab that I was looking at in Chrome). Nothing is being written.
If it helps I'm running WAMP / Apache on Win7 64bit.
Upvotes: 0
Views: 104
Reputation: 11596
You need to use ob_flush()
(https://www.php.net/ob_flush) before calling flush()
. See discussion here and PHP buffer ob_flush() vs. flush().
Upvotes: 1
Reputation: 4877
I think you are looking for more of a logging feature. See error_log() and then find a windows tailing application to monitor the log file.
Upvotes: 0