D
D
Daniil Skatov2017-01-02 17:37:50
linux
Daniil Skatov, 2017-01-02 17:37:50

How is the work with the console using php?

Hey! Please tell me how to work with the Linux console using php? Share libraries if possible. Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OnYourLips, 2017-01-02
@Frost12358

https://symfony.com/doc/current/components/process.html
Normal cross-platform asynchronous work with processes.

use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;

$process = new Process('ls -lsa');
$process->run();

// executes after the command finishes
if (!$process->isSuccessful()) {
    throw new ProcessFailedException($process);
}

echo $process->getOutput();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question