Configuration Options

As shown in the PyhpUse section, after downloading, compiling and installing the PyHP module on you system it will need some basic configuration to get it work. For information about where to find the souce code, compiling and installing, refer to the PyhpUse section of this manual.

After installing, you may need to set up some more configuration options. PyHP configuration is implemented to natively comply with the Apache configuration system, so you can do directly from the Apache configuration file ‘httpd.conf’ or inside a file imported by the Apache configuration system, if you use separate configuration files.

Note

the mod_pyhp module is designed to work with Apache-prefork. It will not work properly in environments using the threaded version of Apache (Apache-worker)!

To configure the options, you can modify the PyHP configuration section like this:

LoadModule pyhp_module /usr/lib/apache2/modules/mod_pyhp.so
<IfModule mod_pyhp.c>
AddType application/x-httpd-pyhp .pyhp

PyHPMode development
PyHPLog apache
PyHPLogLevel debug
PyHPSessionPath /tmp/
PyHPTempPath /tmp/
</IfModule>

The PyHP Mode, Log, Log Level and Session Path clauses inside the If Module statemens allows you to set up module behaviour about operation mode, error reporting and session file storage path.

PyHPMode option

Syntax:

PyHPMode [development | production]
Default setting:
 development

Specifies if module should output complete debug information and flushing the Python cache module for every execution, slowing code performance (development mode) or execute at higher speed enabling module caching and avoiding debugging information output (production mode).

While running your PyHP script, you can know the execution mode reading the pyhp.mode property string.

Note

Whenever you are in development mode, typing a dir or help command in a Python shell will show you the pyhp.rollback object of the PyHPRollbackImporter() class. This is the module cache flush manager, and it won’t need any operation by you to make it work: you should simply avoid creating a new class with the same name.

PyHPLog option

Syntax:

PyHPLog [apache | web | none]
Default setting:
 web

Sets the destination for debug information and warnings: ‘apache’ clause send messages to Apache log files, ‘web’ prints debug messages directly to the web page rendered by the module execution, ‘none’ drops all messages.

PyHPLogLevel option

Syntax:

PyHPLogLevel [debug | info | warning | error]
Default setting:
 debug

Sets the minimum debug messages level to be sent to the log (referring to the level specified in every log call: see LoggingAndException section for more information).

PyHPSessionPath option

Syntax:

PyHPSessionPath path
Default setting:
 (not defined)

Sets the session files saving path. The specified path should already exists and be readable by the Apache user.

PyHPTempPath option

Syntax:

PyHPTempPath path
Default setting:
 (not defined)

Sets the temporary uploaded files saving path. The specified path should already exists and be readable and writable by the Apache user.