1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

how to run linux commands from php and echo the process results while still running ?

Discussion in 'PHP' started by ramysarwat, Dec 25, 2010.

  1. #1
    how to run linux commands from php and echo the process results while still running ?
    SEMrush
     
    ramysarwat, Dec 25, 2010 IP
    SEMrush
  2. owsolution

    owsolution Well-Known Member

    Messages:
    286
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    138
    #2
    I have been writing PHP for about 10 years and I have no clue what you are asking or wanting. Can you give more about what you are wanting to do?
     
    owsolution, Dec 25, 2010 IP
  3. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #3
    Definitely passthru, it is binary safe and the data is passed directly back to the browser.
     
    ThePHPMaster, Dec 25, 2010 IP
  4. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #4
    you can do exec:

    
    exec('command', $result);
    print_r($result);
    
    PHP:
     
    gapz101, Dec 25, 2010 IP
  5. tprinty

    tprinty Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I would do where date is the shell command I want to run

    exec(escapeshellcmd('date', $result));
    print "The result of the date command is " . $date ."\n";
     
    tprinty, Jan 2, 2011 IP
  6. jazzcho

    jazzcho Peon

    Messages:
    326
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    These solution show the result AFTER the shell command has terminated. If he is asking to get partial results, this is not going to do it.
     
    jazzcho, Jan 4, 2011 IP