<!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>Integration with Apache</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="hw.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.hw.html">Hyperwave Functions</a></div> <div class="up"><a href="book.hw.html">Hyperwave</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="hw.apache" class="chapter"> <h1>Integration with Apache</h1> <p class="para"> The Hyperwave extension is best used when PHP is compiled as an Apache module. In such a case the underlying Hyperwave server can be hidden from users almost completely if Apache uses its rewriting engine. The following instructions will explain this. </p> <p class="para"> Since PHP with Hyperwave support built into Apache is intended to replace the native Hyperwave solution based on Wavemaster, we will assume that the Apache server will only serve as a Hyperwave web interface for these examples. This is not necessary but it simplifies the configuration. The concept is quite simple. First of all you need a PHP script which evaluates the <var class="varname"><var class="varname"><a href="reserved.variables.environment.html" class="classname">$_ENV['PATH_INFO']</a></var></var> variable and treats its value as the name of a Hyperwave object. Let's call this script <em>'Hyperwave'</em>. The URL <em>http://your.hostname/Hyperwave/name_of_object</em> would than return the Hyperwave object with the name <em>'name_of_object'</em>. Depending on the type of the object the script has to react accordingly. If it is a collection, it will probably return a list of children. If it is a document it will return the mime type and the content. A slight improvement can be achieved if the Apache rewriting engine is used. From the users point of view it would be more straight forward if the URL <em>http://your.hostname/name_of_object</em> would return the object. The rewriting rule is quite easy: <div class="informalexample"> <div class="example-contents"> <div class="apache-confcode"><pre class="apache-confcode">RewriteRule ^/(.*) /usr/local/apache/htdocs/HyperWave/$1 [L]</pre> </div> </div> </div> Now every URL relates to an object in the Hyperwave server. This causes a simple to solve problem. There is no way to execute a different script, e.g. for searching, than the 'Hyperwave' script. This can be fixed with another rewriting rule like the following: <div class="informalexample"> <div class="example-contents"> <div class="apache-confcode"><pre class="apache-confcode">RewriteRule ^/hw/(.*) /usr/local/apache/htdocs/hw/$1 [L]</pre> </div> </div> </div> This will reserve the directory <var class="filename">/usr/local/apache/htdocs/hw</var> for additional scripts and other files. Just make sure this rule is evaluated before the one above. There is just a little drawback: all Hyperwave objects whose name starts with <em>'hw/'</em> will be shadowed. So, make sure you don't use such names. If you need more directories, e.g. for images just add more rules or place them all in one directory. Before you put those instructions, don't forget to turn on the rewriting engine with <div class="informalexample"> <div class="example-contents"> <div class="apache-confcode"><pre class="apache-confcode">RewriteEngine on</pre> </div> </div> </div> You will need scripts: <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> to return the object itself </span> </li> <li class="listitem"> <span class="simpara"> to allow searching </span> </li> <li class="listitem"> <span class="simpara"> to identify yourself </span> </li> <li class="listitem"> <span class="simpara"> to set your profile </span> </li> <li class="listitem"> <span class="simpara"> one for each additional function like to show the object attributes, to show information about users, to show the status of the server, etc. </span> </li> </ul> </p> <p class="para"> As an alternative to the Rewrite Engine, you can also consider using the Apache <em>ErrorDocument</em> directive, but be aware, that <em>ErrorDocument</em> redirected pages cannot receive POST data. </p> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="hw.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.hw.html">Hyperwave Functions</a></div> <div class="up"><a href="book.hw.html">Hyperwave</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>