php shell 실행문

1) exec

<?php
echo exec(‘whoami’);
?>

 

2) shell_exec

<?php
$output = shell_exec(‘ls -lart’);
echo “<pre>$output</pre>”;
?>

 

3) escapeshellcmd

<?php

$command = ‘./configure ‘.$_POST[‘configure_options’];

$escaped_command = escapeshellcmd($command);

system($escaped_command);

?>

 

4) system

<?php
echo ‘<pre>’;
$last_line = system(‘ls’, $retval);
echo ‘
</pre>
<hr />Last line of the output: ‘ . $last_line . ‘
<hr />Return value: ‘ . $retval;
?>

Leave your Comment

Your email address will not be published. Required fields are marked *