Jump to content

how to execute shell command from browser using php (unix server)


balas

Recommended Posts

hi

 

 

i need to execute shell command using  php in unix server

 

<?

  echo shell_exec('whoami');

?>

 

<?

$output = exec('ls -lart');

echo "<pre>$output</pre>";

?>

 

 

but i cant get output in the browser side.

 

need to enable anythink in the server side ??????

 

give solution for this

 

 

but i cant get output in the browser side.

need to enable anythink in the server side ??????

give solution for this

try to debug (capturing both stdout and stderr)

$output = shell_exec('whoami  2>&1');
echo "<pre>" . $output . "</pre>";

$output = shell_exec('whoami  2>&1');

echo "<pre>" . $output . "</pre>";

 

 

i was trying this also.. i can get the result from local linux server. After that only i have cheked in online unix server..

 

if i will use shell prompt to execute this file, i got result in the teminal mode

 

like #php /location of file

 

no error disply in the browser..

 

just coming only blank result

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.