I found a code from stack follow to execute the register command in ejabberd xmpp chat server using php. (Create ejabberd user from PHP)
I also add "www-data ALL= NOPASSWD: /usr/sbin/ejabberdctl" line in "/etc/sudoers" file in ubuntu linux server 12.0
But when i execute the file i got error:
"read_passphrase: can't open /dev/tty: No such device or address Host key verification failed."
The php code i am using as follows:
`<?php
$username = 'tester';
$password = 'testerspassword';
$node = 'myserver.com';
exec('sudo /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>';
}
?>`
Please help me!
thanks