|
JHP consists of two halves. An webserver module (either an Apache module or an IIS extension), and a small Jade schema. Both are
required for JHP to work.
The latest version can be downloaded from here:
- Copy the mod_jhp.so file into the /usr/lib/apache directory.
- add the following to the /etc/httpd/conf/httpd.conf file:
LoadModule mod_jhp
(Note: add that command in the section of the file where the other LoadModule commands are)
AddModule mod_jhp.c
(Note: add that command in the section of the file where the other AddModule commands are)
add the following at the bottom of the /etc/httpd/conf/commonhttpd.conf file:
<IfModule mod_jhp.c>
AddHandler jhp-parsed .jhp
JHPServerAddress 192.168.1.5
JHPServerPort 7010
JHPJadeTimeout 5000
JHPAllowUndefinedVariables true
</IfModule>
Where:
- JadeServerAddress is the IP Address of the Jade JHP server
- JadeServerPort is the port number of the Jade JHP server (the default is 7010)
- JHPJadeTimeout is the number of ms to try and connect to Jade for
- JHPAllowUndefinedVariables set this to false if you want the http server to generate
an error if Jade embedded code refers to a variable that doesn't exist. Best to leave this on true
Note: Some Linux distributions organise the Apache confirguration files differently. The above is how
it is in Mandrake 9.0 and 9.1
If you have php installed then you can make a .php file that just has:
<?php phpInfo(); ?>
Display that page in a browser and it will tell you which apache modules are loaded. mod_jhp should
be listed as an installed module. (Note that PHP is not required for JHP to work, the previous tip is simply an easy way
to check that JHP is installed.)
- Import the JHPSchema.scm and JHPSchema.ddb files as a subschema of the schema
you want to expose. You will need to click on the "Advanced" button in the schema load form and
specify Subschema of as the schema you wish to expose using JHP. Specify Target schema
as "JHPSchema".
Note: Because of a limitation in Jade, when you import JHPSchema it will complain that 3 of the
classes in the schema file could not be found. If (for example) the schema yo are importing JHPSchema
under is called ABCSchema then make sure the JHPSchema class is subclassed underneath
ABCSchema, GJHPSchema is a subsclass of GABCSchema and SJHPSchema is
a subclass of SABCSchema. This can be done by editing the .scm file during the schema load
process.
- Run the JHPSchema::JHPAdmin application. It will prompt asking for registration information,
if you would like to evaluate it as a demonstration copy then click on the Run Unregistered>
button, otherwise enter the supplied registration code.
- The JHP administration form looks like this:

- Port number: This is the port number the JHP server runs on. This must be
the same as that specified in the commonhttpd.conf file (See Install JHP (Apache module)
section above.
- Enable debugging: When this is checked it will write to the interpreter output
window on each request to the JHP server. Useful for debugging and testing.
- Output Code: When this is checked the code that is executed by Jade (that is send
by the Apache module) is also output to the interpreter output window. Also useful to debugging
and testing.
- Number of worker threads: This is the number of worker threads Jade will use to
process JHP requests from the Apache web server. The default value is 10.
- Start more threads...: The JHP server will start more worker threads when the
number of available threads is equal to (or lower than) the number specified here. Defaults to
2.
- ...and start this many more: When more worker threads are started, this setting
determines how many more will be started. Defaults to 2.
- ...but no more than this many: This determines the maximum number of worker threads
that are started.
- Initialise method: Each time a worker is started this method will be executed. If you would
like each worker thread to be initialised (e.g by setting up reference to root objects etc.) then enter
the name of the initialise method here. This method must exist on the app class.
- Show detailed exception information: When this setting is checked and an exception
occurs, you will be able to click on the exception and more detailed exception information
will be displayed. Note: Only use this for debugging and testing, leaving this setting on
will allow users of your site to see the Jade code that gets executed.
- Exception page: This contains the name of the web page that displays exception
information.
You can stop the JHP server by clicking on the Stop JHP Server button.
Start the JHP server by running the JHPSchema::JHPServer application.
Here is a very simple way to test that JHP has been installed correctly and is working as expected:
In your DocumentRoot directory (e.g. /home/apache/html) make a file called "test.jhp".
In that file put this:
<html></body>
<B>Test JHP page</B><BR>
<?jhp
vars
time: TimeStamp;
begin
echo("The current time is " & time.String & ".");
end;
?>
</body></html>
Display that page in your web browser and hopefully it will have executed the Jade code and displayed
what the current date and time.
Please refer to the JHP manual for more details on using JHP.
|
|