title: How to install the brat annotation tool on a Linux machine with SELinux enabled
body: <p>This is a self-answered question that describes how to resolve problems that occur when installing the <a href="http://brat.nlplab.org/" rel="noreferrer">brat annotation tool</a>, which is used to create annotated corpora for use in NLP, on an ordinary Linux machine that has SELinux enabled. This is based on version 1.3 of the tool.</p>
  
  <p>The installation procedure as <a href="http://brat.nlplab.org/installation.html" rel="noreferrer">documented</a> includes the steps below:</p>
  
  <ol>
  <li>Unpack the .tar.gz file in an (Apache) web server directory, typically <code>/var/www/html</code> or <code>$HOME/public_html</code></li>
  <li>Possibly rename the unpacked directory from <code>brat-v1.3_Crunchy_Frog</code> to something simple such as <code>brat</code></li>
  <li>Enter the directory and run <code>sudo ./install.sh</code></li>
  <li>Start the web server (<code>sudo service httpd start</code>) if it wasn't running already</li>
  </ol>
  
  <p><strong>Problem:</strong> When following this procedure, any attempt to use brat in a browser (by directing it to <code>http://localhost/brat/index.xhtml</code> fails with the following error messages displayed on screen:</p>
  
  <pre><code>Error: ActiongetCollectionInformation failed on error Internal Server Error
  Error: Actionwhoami failed on error Internal Server Error
  Error: ActionloadConf failed on error Internal Server Error
  </code></pre>
  
  <p>The Apache error log (typically found in <code>/var/log/httpd/error_log</code>) also shows errors:</p>
  
  <pre><code>(13)Permission denied: exec of '/var/www/html/new/ajax.cgi' failed, referer: http://localhost/new/index.xhtml
  Premature end of script headers: ajax.cgi, referer: http://localhost/new/index.xhtml
  </code></pre>
  
  <p>How to solve this problem?</p>