getting buffered output from exec?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • D. Alvarado

    getting buffered output from exec?

    Hello, I am running PHP 4 on Apache 1.31 for Fedora Core 2 Linux. I
    run a process

    exec("/bin/sh $my_script", $output, $return);

    that takes about 15-20 seconds but produces multiple lines of output
    throughout. Is there some way I can display the output as it comes
    out as opposed to waiting until the process has finished and then
    displaying the results?

    Thanks, - Dave
  • Colin McKinnon

    #2
    Re: getting buffered output from exec?

    D. Alvarado wrote:
    [color=blue]
    > Hello, I am running PHP 4 on Apache 1.31 for Fedora Core 2 Linux. I
    > run a process
    >
    > exec("/bin/sh $my_script", $output, $return);
    >
    > that takes about 15-20 seconds but produces multiple lines of output
    > throughout. Is there some way I can display the output as it comes
    > out as opposed to waiting until the process has finished and then
    > displaying the results?
    >
    > Thanks, - Dave[/color]

    use proc_open and flush?

    HTH

    C.

    Comment

    • Chung Leong

      #3
      Re: getting buffered output from exec?


      "Colin McKinnon" <colin.deleteth is@andthis.mms3 .com> wrote in message
      news:ckj9j8$4fo $1$830fa17d@new s.demon.co.uk.. .[color=blue]
      > D. Alvarado wrote:
      >[color=green]
      > > Hello, I am running PHP 4 on Apache 1.31 for Fedora Core 2 Linux. I
      > > run a process
      > >
      > > exec("/bin/sh $my_script", $output, $return);
      > >
      > > that takes about 15-20 seconds but produces multiple lines of output
      > > throughout. Is there some way I can display the output as it comes
      > > out as opposed to waiting until the process has finished and then
      > > displaying the results?
      > >
      > > Thanks, - Dave[/color]
      >
      > use proc_open and flush?
      >
      > HTH
      >
      > C.[/color]

      Just popen() should do. Then use fgets() to read each line.


      Comment

      Working...