title: How to do an Apache sub-request with PHP?
body: <p>I am trying to properly display an error document using a PHP function <code>virtual()</code> to users with a "not found" page if a condition is met. This is what I wrote on the script:</p>
  
  <pre><code>// if condition is met
  virtual('/var/www/error/HTTP_NOT_FOUND.html.var');
  </code></pre>
  
  <p>Somehow, a blank page is shown and this is the warning I received:</p>
  
  <blockquote>
    <p>PHP Warning:  virtual(): Unable to include
    '/var/www/error/HTTP_NOT_FOUND.html.var' - request execution failed in
    /var/www/html/test on line 100</p>
  </blockquote>
  
  <p>I have checked that the following are being done:</p>
  
  <ol>
  <li><p>In php.ini, <code>include_path = ".:/var/www/error"</code></p></li>
  <li><p>In httpd.conf,</p>
  
  <pre><code>&lt;IfModule mod_negotiation.c&gt;
  &lt;IfModule mod_include.c&gt;
   &lt;Directory "/var/www/error"&gt;
    Options +Includes
    AddOutputFilter Includes html
    AddHandler type-map var
    Order allow,deny
    Allow from all
   &lt;/Directory&gt;
   ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
  &lt;/IfModule&gt;
  &lt;/IfModule&gt;
  </code></pre></li>
  <li><p>Apache has read access to the error folder and files.</p></li>
  </ol>
  
  <p>What could be causing the warning and how to solve this problem?</p>