NANOWEB, the aEGiS PHP web server
mod_libphp
mod_libphp is an experimental attemp to process php scripts without the need
to invoke a new php interpeter, because this may be under some circumstances
a bit slower. However it turned out, that there is often NO SPEED GAIN,
if you use this module instead of mod_cgi!!
Please note, that this module makes use of the PHP
pcntl extension,
and thus
CANNOT BE USED UNDER WINDOWS, as current Windows versions
don't support UNIX compatible process forking.
Limitations
Before you start to test (don't forget this step!!) this module, you should
know that it uses very stupid tricks to achieve this "internal processing"
of php scripts, and thus
following things don't work:
- scripts run inside mod_libphp cannot define functions that were already
used inside nanoweb (for example: "errexit", "techo", "loadfile",
"load_modules", "modules_init", "access_query", "log_srv",
"reload_config", "send_response", ...)
- header() and setcookie() won't work, so there is a new nwheader() which
must be used (nwsetcookie will be implemented later)
- mod_libphp only handles GET requests, anything else is passed to be
handled by mod_cgi, which works more accurately
If you thought about all these drawbacks and have ensured that none of the
nanoweb internal functions will be redefined by your script and that the
unsupported ones are not critical to it, you can try to run it under
mod_libphp instead of the real php.
To activate the module you must load it into the server and setup
ParseExt accordingly:
#ParseExt = php LPHP
ParseExt = lphp LPHP
You should activate mod_libphp for all scripts not before you really have
tested that it works! Instead of activating it for all scripts you may only
want to run some of them inside nanoweb by changing their extension to
.lphp as defined by the above ParseExt directive (such a .lphp
script may itself include() any other ordinary .php of course).
This module is deactivated per default of course, due to its guessworking
nature; and may not even be included in your nanoweb tarball. You have to
edit
nanoweb.php, search for "libphpHACK" and uncomment these few
lines that make it work.
bugreports are welcome: mario@erphesfurt·de
NANOWEB, the aEGiS PHP web server