我從堆棧中找到一個代碼,然後使用php在ejabberd xmpp聊天服務器中執行register命令。 (Create ejabberd user from PHP)如何從php註冊ejabberd用戶?
我還添加 「WWW的數據ALL = NOPASSWD:/ usr/sbin目錄/ ejabberdctl」 行中的 「的/ etc/sudoers的」 文件中的ubuntu Linux服務器12.0
但是,當我執行該文件我出現錯誤:
「read_passphrase:can not open/dev/tty:No such device or address Host key verification failed。」
我使用的PHP代碼如下:
`<?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>';
}
?>`
請幫幫我!
感謝
嗨,這是一個PHP的問題,你將有如果你按照 – ppolv 2013-02-12 13:44:55