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 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>"; 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? 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 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
Archived
This topic is now archived and is closed to further replies.