0

I have a problem, is this possible to run the bash command from PHP level?

TarasB
  • 2,407
  • 1
  • 24
  • 32

2 Answers2

1

A lot of functions exist, allowing you to have the precision level you want.

The only way to choose is to read the doc for these functions.

I post you some links to read :

http://php.net/manual/en/function.proc-open.php

http://php.net/manual/en/function.popen.php

http://php.net/manual/en/function.shell-exec.php

http://php.net/manual/en/function.exec.php

http://php.net/manual/en/function.passthru.php

biziclop
  • 14,466
  • 3
  • 49
  • 65
Kern
  • 858
  • 1
  • 8
  • 24
0

If you need to execute a command from php you can do it using the native function system() or exec(). For example if you would like execute bash command uname -a, with system call:

$output = system("uname -a", $status);

second argument is optionally; if it's present, return the status of the executed command. For more details i suggest you to take a look to follow php man pages

http://it2.php.net/manual/en/function.system.php

http://it2.php.net/manual/en/function.exec.php

sergioska
  • 325
  • 5
  • 18