hlstriker Posted August 12, 2007 Share Posted August 12, 2007 Hi, can someone please tell me how I can send commands from a web page into my linux box? Example: There is a button on the web page that says 'Send'. When this button it pressed it will send the command '/home/user/myscript' which will run the myscript script. Quote Link to comment https://forums.phpfreaks.com/topic/64528-send-cmds-from-webpage-to-linux-box/ Share on other sites More sharing options...
Fadion Posted August 12, 2007 Share Posted August 12, 2007 U can use exec(), system(), passthru() or by using backtick `. $command = 'ls www'; exec($command, $output); foreach($output as $value){ echo $value . "<br />"; } Quote Link to comment https://forums.phpfreaks.com/topic/64528-send-cmds-from-webpage-to-linux-box/#findComment-321770 Share on other sites More sharing options...
hlstriker Posted August 12, 2007 Author Share Posted August 12, 2007 Ok thanks, but is it possible to do this remotely? My web server is on a different computer then the computer I want to run the commands on. Quote Link to comment https://forums.phpfreaks.com/topic/64528-send-cmds-from-webpage-to-linux-box/#findComment-321852 Share on other sites More sharing options...
balistic Posted August 12, 2007 Share Posted August 12, 2007 you can run the script from anywhere, as long as the functions arent disabled and you arent in safe mode. Quote Link to comment https://forums.phpfreaks.com/topic/64528-send-cmds-from-webpage-to-linux-box/#findComment-321868 Share on other sites More sharing options...
Fadion Posted August 12, 2007 Share Posted August 12, 2007 Those commands will run only on your web server. I guess theres no way of executing remote commands. If with remote u mean executing commands from your pc to the webserver then yes as long as these commands are not in disable_functions and safe_mode is off. Quote Link to comment https://forums.phpfreaks.com/topic/64528-send-cmds-from-webpage-to-linux-box/#findComment-321957 Share on other sites More sharing options...
trq Posted August 13, 2007 Share Posted August 13, 2007 You might want to take a look at the ssh extension. Quote Link to comment https://forums.phpfreaks.com/topic/64528-send-cmds-from-webpage-to-linux-box/#findComment-321963 Share on other sites More sharing options...
Fadion Posted August 13, 2007 Share Posted August 13, 2007 You might want to take a look at the ssh extension. Very nice one, didnt know that. Quote Link to comment https://forums.phpfreaks.com/topic/64528-send-cmds-from-webpage-to-linux-box/#findComment-321974 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.