title: doc2pdf - unable to connect or start own listener
body: <h1>command</h1>
  
  <pre><code>$file = '/var/www/test.docx';
  move_uploaded_file($uploaded_file, $file);
  echo 'is file: '.is_file($file)."\n";
  
  exec('/usr/bin/doc2pdf -o '.$file.'.new '.$file.' 2&gt;&amp;1', $out);
  print_r($out);
  </code></pre>
  
  <h1>output</h1>
  
  <pre><code>is file: 1
  Array
  (
      [0] =&gt; Error: Unable to connect or start own listener. Aborting.
  )
  </code></pre>
  
  <p>This is a part of an upload script and is running as <code>www-data</code> under Apache..</p>
  
  <p>The command line alone works fine from putty as <code>root</code></p>
  
  <p>The script has worked under <code>www-data</code>, but now it doesn't? :-/</p>
  
  <h1>update I</h1>
  
  <pre><code>apt-get install sudo
  sudo visudo # added "www-data ALL = NOPASSWD: /usr/bin/doc2pdf"
  </code></pre>
  
  <p>code:</p>
  
  <pre><code>exec('sudo /usr/bin/doc2pdf -o '.$file.'.new '.$file.' 2&gt;&amp;1', $out);
  print_r($out);
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>sudo: unable to resolve host dyntest-amd-3700-2gb
  </code></pre>
  
  <h1>update II</h1>
  
  <pre><code>echo "127.0.1.1 $(hostname)" &gt;&gt; /etc/hosts
  reboot
  </code></pre>