davetechfreak Posted February 7, 2011 Share Posted February 7, 2011 Hi guys, I am new here, and I am a bit stuck with doing something unusual. I want to create a script that can turn on a program (dynamips and dynagen). So far, I have tried 'exec' and 'shell_exec'. Soon I realized that apache runs the commands as 'www-data' user (apache2 in ubuntu) and it's very limited on what you can execute. Is there any way to do that at all? What would be the best practice? I am not concerned about security as this is not a production environment... Thanks Link to comment https://forums.phpfreaks.com/topic/226964-execute-a-shell-command-php-script/ Share on other sites More sharing options...
AbraCadaver Posted February 7, 2011 Share Posted February 7, 2011 Run the command with sudo. Setup the sudoers file to allow the web user to run specific commands without a password: http://linuxmanpages.com/man5/sudoers.5.php Link to comment https://forums.phpfreaks.com/topic/226964-execute-a-shell-command-php-script/#findComment-1171062 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.