mod_wxjs is an Apache module. Use this to create dynamic webpages with JavaScript, E4X, wxWidgets portable code, ...


mod_wxjs is tested on Apache version 2.2.6. If you haven't installed Apache yet, I recommend you to use the latest XAMPP distribution. It contains everything you need to develop websites on an Apache server.

When you use a different version and you encounter problems, you can try to build mod_wxjs against the Apache libraries of your version.

Before you can use mod_wxjs you have to change the configuration file of Apache: httpd.conf

Path to DLL's

mod_wxjs uses several dll's. Or you make sure that the PATH environment variable is extended with the bin-directory of wxJavaScript, or you load all these DLL's with the LoadFile directive: js.dll, libnspr4.dll (On linux these files are .so files) are required.


You have to load the wxjs module and associate the 'wxjs' handler with file extensions. These files will be processed by mod_wxjs. Other things which you can configure:

  • wxJS_Modules: the path to modules.js file
  • wxJS_RtSize: the size of the runtime (M --> Megabyte, K --> Kilobyte)
  • wxJS_CtxSize: the size of the context (M --> Megabyte, K --> Kilobyte)
  • wxJS_PreScript: the script to execute before running the main script (use a full path).
  • wxJS_PostScript: the script to execute after running the main script (use a full path).
  • wxJS_Encoding: the encoding of the scripts (default is UTF-8)
wxJS_PreScript and wxJS_PostScript can also be used in a .htaccess file. In a .htaccess file, you can use a relative path. You can use a slash to ignore directives defined in a higher folder.

The following configurations are derived from libapreq2:

  • wxJS_APREQ2_TempDir: Default location of temporary directory
  • wxJS_APREQ2_ReadLimit: Maximum amount of data that will be fed into a parser. Default is 64 (MB).
  • wxJS_APREQ2_BrigadeLimit: Maximum in-memory bytes a brigade may use. Default is 256 (K).

Keep in mind that each virtual host gets its own runtime.
          LoadModule wxjs_module "c:/wxjs/bin/mod_wxjs.dll"
          AddHandler wxjs .wxjs
          wxJS_Modules "c:/wxjs/modules.js"
          wxJS_RtSize 1M
          wxJS_CtxSize 8K

An example

Each page is run in its own context. The following objects are constructed before the script is run: request which is a HttpRequest, and response which is a HttpResponse.

response.print("<html><head><title>wxJS test program</title></head><body>");
response.print("<b>Hello world</b>");

Read this tutorial for using mod_wxjs with the template engine and sqlite.

Design downloaded from Free website templates, layouts, and tools.