Hastymail and WASD PHP

These are some guidelines for installing and configuring Hastymail for PHP under WASD.

http://Hastymail.sourceforge.net/

It is not a definitive document.  It is basically just a description of how I managed to get Hastymail running.  There are undoubtably alternate approaches.  These guidelines were developed using Hastymail out-of-the-box.  Only required configuration changes have been made according to Hastymail installation notes.  Hastymail uses a couple of *nix directory areas by default;  /var  to store profile and session files, and  /etc  to store the Hastymail configuration file.  These areas have been provided to the Hastymail runtime using script-process logical names for the corresponding VMS file-system areas.  This can be seen being done in the wrapper script.

For those who may have used the previous HastymAIL_050111.ZIP setup kit - this guideline does things slightly differently.

This software configuration information is provided under the terms of the GNU General Public Licence as published by the Free Software Foundation; version 2 of the License, or any later version.

16 January 2005

Disclaimer

I am not an administrator and only a casual user of Hastymail.  I undertook this exercise to demonstrate how it might be supported under WASD PHP.  There is no point in querying me personally on Hastymail setup, quirks, changes, etc.  If there is something incorrect within these guidelines or information by which they could be improved then by all means advise me.  Likewise if it's suspected WASD or WASD PHP is misbehaving itself or requires refinement.

mark.daniel@wasd.vsm.com.au

Session File Access Conflict

PHP-based webmail applications that use HTML frames are prone to conflicts of access to it's on-disk session files.  This is well known and documented issue with CSWS PHP 1.2 (PHP 4.3.2) that takes two forms.  File-access conflict, where one frame reports the session file locked by another process.  This can be circumvented using the  DECC$FILE_SHARING  feature logical name.  When this is enabled a second issue immediately has the potential to cause problems.  It would appear as if the session file is emptied by one process (frame) while attempting to be read by another (frame).  This results in an error message and/or ACCVIO.  Obviously this is a major issue.  Anyone has a fix for these behaviours?

Hastymail, being a single frame application, is not affected by this issue.

Requirements

These guidelines were developed in the following environment.  Other combinations may work, or may not.

Installation

Restore the archive to disk.
$ set process /parse=extended
$ set default ODS5_DISK:[000000]
$ vmstar -xf dev:[dir]Hastymail-1^.2.tar
This creates a directory
ODS5_DISK:[Hastymail-1^.2]

File-System

A concealed device logical name must be defined.  To make this permanent it needs to placed in a system or Web-related startup procedure.
$ define /system /executive /translation=concealed -
Hastymail ODS5_DISK:[Hastymail-1^.2.]
This directory structure must be made accessable to the default WASD server and scripting accounts.
$ sechan == "$ht_exe:sechan"
$ sechan /asif=runtime ODS5_DISK:[000000]Hastymail-1^.2.dir
$ sechan /asif=runtime ODS5_DISK:[Hastymail-1^.2...]*.*
If a different account is used to execute Hastymail similar considerations will need to be made.

Runtime Storage

Hastymail on a *nix platform will store it's session and other runtime data in the /var directory.  For Hastymail on VMS under WASD this will be emulated.  A directory structure separate from the Hastymail source will be created.
$ create /directory ODS5_DISK:[Hastymail-var.Hastymail.session]
$ create /directory ODS5_DISK:[Hastymail-var.Hastymail.settings.attachments]
This directory structure must be made readable by the server account and writeable by the scripting account.
$ sechan /asif=runtime ODS5_DISK:[000000]Hastymail-var.dir
$ sechan /asif=scratch ODS5_DISK:[Hastymail-var...]*.dir
$ set file /version=1 ODS5_DISK:[Hastymail-var...]*.dir
If a different account is used to execute Hastymail similar considerations will need to be made.

A concealed device logical name must be defined.  To make this permanent it needs to placed in a system or Web-related startup procedure.
$ define /system /executive /translation=concealed
-
         Hastymail-var ODS5_DISK:[Hastymail-var.]
Unwanted files may accumulate over time in these areas.  This can happen if a user does not explicitly logout of their Hastymail session and then creates another from a fresh browser.  Some routine cleanup is required.  The wrapper script provides for deleting session and attachment files older than two days each time it is first started up.

PHP Configuration

Hastymail requires some tailored initialization parameters.
$ copy ht_root:[src.php]php.ini Hastymail:[000000]phpwasd.ini
$ edit Hastymail:[000000]phpwasd.ini
Modify or add the following parameters:
include_path = ".:.."
extension = php_pcre.exe
extension = php_session.exe
extension = php_xml.exe
session.save_path = /var/Hastymail/session
Check Hastymail configuration documentation for other recommended settings.

WASD Scripting Wrapper

A Hastymail-specific wrapper procedure  HastymAIL.COM  can be placed in  HT_ROOT:[CGI-BIN]
$! HASTYMAIL.COM
$ set noon
$!(clean up any lingering session files, etc., older than two days)
$ define /user sys$output nl:
$ define /user sys$error nl:
$ delete hastymail-var:[hastymail.sessions...]*.*;* /before=-2-00:00:00
$ define /user sys$output nl:
$ define /user sys$error nl:
$ delete hastymail-var:[hastymail.settings.attachments...]*.*;* /before=-2-00:00:00
$ define decc$argv_parse_style enable
$ define decc$efs_case_preserve enable
$ define decc$efs_charset enable
$ define decc$efs_case_special enable
$ define decc$enable_getenv_cache enable
$ define decc$posix_seek_stream_file enable
$ define decc$file_sharing enable
$ define var hastymail-var
$ define etc hastymail
$ define phpwasd$ini hastymail:[000000]phpwasd.ini
$ mcr cgi_exe:phpwasd.exe

WASD Mapping Rules

WASD mapping rules then make the application accessable.
# HTTPD$MAP
map /hastymail**/ /hastymail/index.php
exec /hastymail/**.php (@cgi-bin:[000000]hastymail.com)/hastymail/*.php \
    ods=5 script=syntax=unix script=query=relaxed map=once
pass /hastymail/* /hastymail/* dir=noaccess
If you wish to be able to browse the source using the Web server you can also add a rule something like
pass /_hastymail/* /ODS5_DISK/hastymail-1.2/*
Load these new rules into the server:
$ HTTPD /DO=MAP

HastyMail Configuration

A configuration file needs to be created before HastyMail can be used.
$ copy hastymail:[000000]hastymail.conf-example hastymail:[000000]hastymail.conf 
$ sechan /asif=runtime hastymail:[000000]hastymail.conf
In addition there is required security-related change before HastyMail will fire-up.
$ edit hastymail:[lib]constant.php
Modify the value of  $hasty_key  to just about any other than the default string.
/* key for hastymail's encryption */
$hasty_key = 'You should be using the more secure version!';

Application Access

Using the above mapping rules the basic method for accessing the application is
http://the.host.name/hastymail/

- end of document -