Jump to content

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


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

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.