pugboy Posted June 17, 2009 Share Posted June 17, 2009 I have a dedicated server running Apache and OpenVZ, and would like to run a simple start/stop VPS script through exec, system, or whatever. I have tried ALL of the commands, putting the actual start command inside of a SH file, and CHMODing the files to 777. No luck. How do you execute a command like VZCtl through the PHP functions? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/162677-php-exec-system-shell_exec-urgent/ Share on other sites More sharing options...
pugboy Posted June 17, 2009 Author Share Posted June 17, 2009 Can anyone help? Not getting any response on IRC either Quote Link to comment https://forums.phpfreaks.com/topic/162677-php-exec-system-shell_exec-urgent/#findComment-858523 Share on other sites More sharing options...
MadTechie Posted June 18, 2009 Share Posted June 18, 2009 Rules 2. Users will not mark their post as being "URGENT" by either making the post ALL CAPS or adding any hint that they need it done Quick or ASAP. All posts are treated equal, your post is no more important than any other user's post on this forum. If it is "URGENT" pay someone to do it. 17. Users should not "bump" topics that are still on the first page of the forums. If you bump, you must provide additional information. If you resort to bumping, chances are your question needs to be re-thought and re-described (see Eric Raymond's "How To Ask Questions The Smart Way"). Quote Link to comment https://forums.phpfreaks.com/topic/162677-php-exec-system-shell_exec-urgent/#findComment-858547 Share on other sites More sharing options...
pugboy Posted June 18, 2009 Author Share Posted June 18, 2009 Oh, sorry. Can you edit the title, or am I able to? Quote Link to comment https://forums.phpfreaks.com/topic/162677-php-exec-system-shell_exec-urgent/#findComment-858548 Share on other sites More sharing options...
MadTechie Posted June 18, 2009 Share Posted June 18, 2009 when you used system() or exec() did you enter the full path to the VZCtl ? (sorry i don't use VZCtl) also have you checked the error logs ? Quote Link to comment https://forums.phpfreaks.com/topic/162677-php-exec-system-shell_exec-urgent/#findComment-858553 Share on other sites More sharing options...
pugboy Posted June 18, 2009 Author Share Posted June 18, 2009 Where could I find the error logs? I have tried using exec and system with and without full paths. Quote Link to comment https://forums.phpfreaks.com/topic/162677-php-exec-system-shell_exec-urgent/#findComment-858555 Share on other sites More sharing options...
MadTechie Posted June 18, 2009 Share Posted June 18, 2009 if you look in php.ini or phpinfo(); look for error_log that should give you the path to the error logs Quote Link to comment https://forums.phpfreaks.com/topic/162677-php-exec-system-shell_exec-urgent/#findComment-858558 Share on other sites More sharing options...
pugboy Posted June 18, 2009 Author Share Posted June 18, 2009 Ok, thanks. Looking at the error log now... EDIT: No errors in the log... The command seems to not be executing or something.... Quote Link to comment https://forums.phpfreaks.com/topic/162677-php-exec-system-shell_exec-urgent/#findComment-858559 Share on other sites More sharing options...
MadTechie Posted June 18, 2009 Share Posted June 18, 2009 is the problem only related to that app? for example does this work ? <?php $output = shell_exec('ls '); echo "<pre>$output</pre>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/162677-php-exec-system-shell_exec-urgent/#findComment-858562 Share on other sites More sharing options...
trq Posted June 18, 2009 Share Posted June 18, 2009 vzctl needs to be executed as root. You will need to setup sudo to allow your apache process owner to become root and execute vzctl. Quote Link to comment https://forums.phpfreaks.com/topic/162677-php-exec-system-shell_exec-urgent/#findComment-858731 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.