title: Calling ejabberdctl from PHP
body: <p>I am working on a php social network that requires us to create XMPP accounts for all new members. I have a working Ejabberd server running with mod_admin_extra all working fine. </p>
  
  <p>I am trying to call ejabberdctl from a php file like so:</p>
  
  <pre><code>exec('sudo /home/user/ejabberd-2.1.2/bin/ejabberdctl register test server pass 2&gt;&amp;1');
  </code></pre>
  
  <p>but i get the following error :</p>
  
  <pre><code>Failed RPC connection to the node ejabberd@localhost: nodedown
  </code></pre>
  
  <p>Although the same command works from the command line.</p>
  
  <p>I have also added the following to /etc/sudoers :</p>
  
  <pre><code>www-data ALL= NOPASSWD: /home/webuser/ejabberd-2.1.2/bin/ejabberdctl
  </code></pre>
  
  <p>So what gives?</p>