PHP output to command line

I run my script from the command line and prints everything as they appear, but a week ago it stopped output and now prints everything when the script ends. I have ob_start (), but as I know, this does not affect the output of the command line.

+4
source share
2 answers

You need to remove ob_start () ... try this code on the command line and it will print the text immediately:

<? ob_start(); echo "test\n"; sleep(10); echo "buffer\n"; ?> 
+5
source

It would be very helpful if you could place the script here, at least the relevant parts, but the things that I tested:

  • Did you enable buffering?
  • Are you running the process as something like nohup or something else that can buffer it?
  • Have you changed any other buffering settings?

Output only at the end of the script seems to be a buffering problem.

0
source

All Articles