<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Perform an Apache sub-request</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.getallheaders.html">getallheaders</a></div> <div class="next" style="text-align: right; float: right;"><a href="book.fpm.html">FastCGI Process Manager</a></div> <div class="up"><a href="ref.apache.html">Apache Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.virtual" class="refentry"> <div class="refnamediv"> <h1 class="refname">virtual</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">virtual</span> — <span class="dc-title">Perform an Apache sub-request</span></p> </div> <div class="refsect1 description" id="refsect1-function.virtual-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>virtual</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span> )</div> <p class="para rdfs-comment"> <span class="function"><strong>virtual()</strong></span> is an Apache-specific function which is similar to <em><!--#include virtual...--></em> in <em>mod_include</em>. It performs an Apache sub-request. It is useful for including CGI scripts or <var class="filename">.shtml</var> files, or anything else that you would parse through Apache. Note that for a CGI script, the script must generate valid CGI headers. At the minimum that means it must generate a <em>Content-Type</em> header. </p> <p class="para"> To run the sub-request, all buffers are terminated and flushed to the browser, pending headers are sent too. </p> <p class="simpara">This function is only supported when PHP is installed as an Apache module.</p> </div> <div class="refsect1 parameters" id="refsect1-function.virtual-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">filename</code></em></span> <dd> <p class="para"> The file that the virtual command will be performed on. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.virtual-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Performs the virtual command on success, or returns <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 changelog" id="refsect1-function.virtual-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>4.3.3</td> <td> <p class="para">As of PHP 4.3.3 you can use this function with the <a href="book.nsapi.html" class="link">NSAPI server module</a> in Netscape/iPlanet/SunONE webservers, too.</p> </td> </tr> <tr> <td>4.0.6</td> <td> This function may be used on PHP files. However, it is typically better to use <span class="function"><a href="function.include.html" class="function">include</a></span> or <span class="function"><a href="function.require.html" class="function">require</a></span> for PHP files. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 examples" id="refsect1-function.virtual-examples"> <h3 class="title">Examples</h3> <p class="para"> See <span class="function"><a href="function.apache-note.html" class="function">apache_note()</a></span> for an example. </p> </div> <div class="refsect1 notes" id="refsect1-function.virtual-notes"> <h3 class="title">Notes</h3> <div class="warning"><strong class="warning">Warning</strong> <p class="para"> The query string can be passed to the included file but <var class="varname"><var class="varname"><a href="reserved.variables.get.html" class="classname">$_GET</a></var></var> is copied from the parent script and only <var class="varname"><var class="varname"><a href="reserved.variables.server.html" class="classname">$_SERVER['QUERY_STRING']</a></var></var> is filled with the passed query string. The query string may only be passed when using Apache 2. The requested file will not be listed in the Apache access log. </p> </div> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> Environment variables set in the requested file are not visible to the calling script. </p> </p></blockquote> </div> <div class="refsect1 seealso" id="refsect1-function.virtual-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.apache-note.html" class="function" rel="rdfs-seeAlso">apache_note()</a> - Get and set apache request notes</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.getallheaders.html">getallheaders</a></div> <div class="next" style="text-align: right; float: right;"><a href="book.fpm.html">FastCGI Process Manager</a></div> <div class="up"><a href="ref.apache.html">Apache Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>