I found a code from stack over flow to execute the register command in ejabberd xmpp chat server using php. (Create ejabberd user from PHP)
But when i execute the file i got error:
"sudo: unknown user: ejabberd" "sudo: unable to initialize policy plugin"
I am runing this code on my ubuntu(14.04 LTS 64-bit) machine The php code i am using as follows:
<?php
$username = 'tester';
$password = 'testerspassword';
$node = 'myserver.com';
exec('sudo -u ejabberd /usr/sbin/ejabberdctl register '.$username.' '.$node.' '.$password.' 2>&1',$output,$status);
if($output == 0)
{
// Success!
}
else
{
// Failure, $output has the details
echo '<pre>';
foreach($output as $o)
{
echo $o."\n";
}
echo '</pre>';
}
?>