half.italian Posted October 19, 2006 Share Posted October 19, 2006 I've tried a couple of Python forums with this question, but the more I think about it, the more I think has something to do with the apache environment.I'm basically trying to have a php page pass one string variable and execute a command on the server using that variable. I found php system() and exec() and am using system(). The command is executed. So far so good. Inside the script (which is python) I use expect to become root, and execute several commands. Here's the glitch. If I run the python script from the command line, as 'www' (the user my apache runs as) it becomes root as it should and executes the commands sucessfully. But, If I have a php script execute the exact same python script, expect does not accept the password, and the commands fail.I've come to realize that there is something in the apache environment that is not allowing 'www' to become root. Any ideas on what is going on, or even ideas on how to debug?? I'm at a loss. Thanks in advance.~Sean D Quote Link to comment https://forums.phpfreaks.com/topic/24391-apache-php-python-and-expect/ Share on other sites More sharing options...
half.italian Posted October 19, 2006 Author Share Posted October 19, 2006 Just to close the loop: On some advice, instead of using expect, I added an entry to /etc/sudoers so the script could run itself as root. Problem solved. Don''t know why I didn't thin of that. Quote Link to comment https://forums.phpfreaks.com/topic/24391-apache-php-python-and-expect/#findComment-111534 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.