balas Posted September 26, 2007 Share Posted September 26, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/70725-how-to-execute-shell-command-from-browser-using-php-unix-server/ Share on other sites More sharing options...
hvle Posted September 26, 2007 Share Posted September 26, 2007 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>"; Quote Link to comment https://forums.phpfreaks.com/topic/70725-how-to-execute-shell-command-from-browser-using-php-unix-server/#findComment-355488 Share on other sites More sharing options...
youscript Posted September 26, 2007 Share Posted September 26, 2007 any error found? Quote Link to comment https://forums.phpfreaks.com/topic/70725-how-to-execute-shell-command-from-browser-using-php-unix-server/#findComment-355512 Share on other sites More sharing options...
balas Posted September 26, 2007 Author Share Posted September 26, 2007 $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 Quote Link to comment https://forums.phpfreaks.com/topic/70725-how-to-execute-shell-command-from-browser-using-php-unix-server/#findComment-355611 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.