I am executing a SUDO command in PHP script,
$username = 'tester';
$password = 'testerspassword';
$node = 'localhost';
exec('sudo /usr/sbin/ejabberdctl register '.$username.' '.$node.' '.$password.' 2>&1',$output,$status);
When i am trying with putty and executing same as
sudo ejabberdctl register testuser1 localhost pass123
Its working , but through PHP script its not working. How to execute it through PHP script,If required to include .ppk file and username for verification then how to use it ?
Thanks in advanced!
PHP is executed under the user account of Apache.
You should add this user(usually called www-data, apache or similar) to /etc/sudoer
...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.