Forgotten Player agucova Forgotten Player agucova - 4 years ago 293
PHP Question

Pass STDOUT (Bash) to PHP Variable

I want to pass the stdout of a command in bash (ex.

) to a PHP variable, let's say
How this can be done?

Answer Source

Use shell_exec for returning the output of shell commands:

    $output = shell_exec('uptime');
    echo $output;


18:17  up 12 days, 13:39, 3 users, load averages: 1.80 1.78 1.75

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download