php call os command code example Example 1: exec output php $output = exec('ls'); Example 2: php run command line shell_exec('ls'); // or exec('ls');