help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



Notes

A config file for Powtils web programs looks like this:

  #..\library\pwu\pwu-1.6.0.2.dll

  # COMMENT: CONFIG FILE 
  header_charset = iso-8859-1
  error_reporting = on
  error_halt = off
  output_buffering = on
  output_compression = on
  session_path = "session/sess.sds"
  session_life_time = 25
  upload_max_size = 20

Line one contains the path (preceded by pound sign) to the DLL/DSO if you are using dynpwu.pas. If you are using pwumain.pas then no path on line one is required.

Troubleshooting Config File

Incorrect syntax in config files may cause these problems.

No Config File

You can choose not to use a config file in version 1.6.1 by disabling the CFG_ON define in pwumain.pas. You can use SetWebConfig to set configuration in the program. At current date of writing, dynpwu.pas may require a config file always, while pwumain you will have the option to set the define.

Config file

In version 1.6.0.X You must have a config file stored in each CGI program's directory or in one single global location. If you have:

Note: In version 1.5, the config file is named pwu.conf for both operating systems.

An example of a config file is included in your zip or gzip package that you downloaded from sourceforge in the /src/conf/ or /config/ directory. There are also config files in the subdirectories inside the /examples/ folder.

Paths inside the config file can be absolute or relative.

Document Root Relativity

In the library path on line one you can use a $DOCROOT macro which points to the server DOCUMENT_ROOT directory. This is handy so that you do not have to keep updating absolute paths when moving or migrating programs to different servers.

Even if your cgi bin directory is not inside DOCROOT on the server, it is still relative to it in some way for example $DOCROOT/../../sub/ is two directories back from public html.

One Main Config File

In version 1.6.0.1 and up, you can store the config file in a global directory which all programs access by default. If you wish to override the settings in the global config file on a per directory basis, you simply upload a config file to the directory that your program is in and all settings are overridden. If you are using a local config file in the CGI program's directory, the global config file settings are not inherited, so you must make a complete config file.

The global location of the config file is $DOCROOT/pwu/conf/ or $DOCROOT/../pwu/conf/ where DOCROOT resembles your document root directory, such as /public_html/ or /www/ or /home/user/www/ or c:\program files\apache group\htdocs\. The utilities search first for a config file in the directory that the CGI program is being launched from, then they search for default global locations such as /public_html/pwu/conf/.

Note that in version 1.5 and 1.6.0.0 there is no global config file. Only in 1.6.0.1 or latest SVN was this feature introduced.

Tips

When testing programs, sometimes you may launch your executable programs from the command line without using a web browser or web server. The program has no idea about your document root in this case. Global config files will not work when launching from the command line, unless you somehow figure out how to trick your system into knowing about where document root is. This is because global config files rely on document root relativity.

The $DOCROOT macro is internally determined by making a call to the DOCUMENT_ROOT server variable (see pwuenvvar). The web server must launch the program for the global config file to have knowledge about document root; and since running a program from the command line does not launch the program through the web server, DOCUMENT_ROOT is unknown from the console. In other words, use local config files in the cgi program's directory if you want your program to work at the command line without any web server, or use 1.6.1 and disable the CFG_ON define.






lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505