This is an interface to a PHP interpreter engine and environment for the WASD OpenVMS Web server. It is designed to be able to be used in standard CGI and CGIplus/RTE persistent scripting modes. The persistent modes provide a ~10x (yes, an approximate ten times) improvement in script activation times and reduced load on server and system. PHPWASD cannot be used interactively or at the command line, it is only for scripting use. Note that this package does not contain the PHP engine, that has to be obtained and installed separately.
PHPWASD is linked
against the [C]SWS (OpenVMS Apache) PHP interpreter
shareable image and so shares a set of PHP capabilities in common with
OpenVMS Apache.
Alpha VMS Version |
Minimum C RTL ECO Version |
---|---|
V7.2-2 |
ACRTL-V0400 |
V7.3 |
ACRTL-V0600 |
V7.3-1 |
ACRTL-V0300 |
V7.3-2 |
(none) |
An incompatible C RTL can easily be diagnosed:
$ MCR HT_ROOT:[PHP.BIN]PHP.EXE -v
%IMGACT-F-SYMVECMIS, shareable image's symbol vector table mismatch
-IMGACT-F-FIXUPERR, error when PHPSHR referenced DECC$SHR
Directory | Purpose |
---|---|
HT_ROOT:[SRC.PHP] | Source code for PHPWASD. Contains nothing from the CSWS PHP kit. |
HT_ROOT:[PHP.AXP] HT_ROOT:[PHP.IA64] |
Location of the architecture independent PHP_ROOT logical name. Executable components of the scripting environment (e.g. PHPSHR.EXE, extension shareable images). The [.SCRIPTS] directory could be used for .PHP files with appropropriate mappings. |
HT_ROOT:[CGI-BIN] | Contains the .PHP script files. This may be changed (to [.SCRIPTS] for example) via mappings. |
HT_ROOT:[AXP-BIN] HT_ROOT:[IA64-BIN] |
PHP interface; PHPWASD.EXE image |
Allowed to SCRIPT_FILENAME to be specified in Unix-style syntax
to
support the WASD v9.0 script=syntax=unix mapping
rule. This feature was added to allow PHP applications expecting
all request parameter file specifications (e.g. PATH_TRANSLATED,
SCRIPT_FILENAME) to be in a slash-separated format to be supported.
Provides for a secondary PHP.INI file. This allows a site-wide, primary PHP.INI (usually in PHP_ROOT:[000000]PHP.INI) to specify the fundamental site PHP configuration and then allow the secondary, perhaps per-script/application configuration file to modify those basics to suit. This means the secondary initialization files can be far smaller and simpler than they might otherwise.
Allows the location of the secondary initialization file to be specified by mapping rule.
Allows PHP.INI directives to be specified by mapping rule, allow fine tailoring of script processing.
Automatically translates SCRIPT_FILENAME and PATH_TRANSLATED to Unix-style syntax.
CSWS_PHP | WASD |
---|---|
[APACHE.PHP.BIN]PHP.EXE | HT_ROOT:[PHP.AXP.BIN] HT_ROOT:[PHP.IA64.BIN] |
[APACHE.PHP.BIN]PHPSHR.EXE | HT_ROOT:[PHP.AXP.BIN] HT_ROOT:[PHP.IA64.BIN] |
[APACHE.PHP.EXTENSIONS]*.EXE | HT_ROOT:[PHP.AXP.EXTENSIONS] HT_ROOT:[PHP.IA64.EXTENSIONS] |
[APACHE.PHP.SCRIPTS]*.PHP | HT_ROOT:[PHP.AXP.SCRIPTS] HT_ROOT:[PHP.IA64.SCRIPTS] |
The CSWS PHP 1.2 kit contains a significant number of PHP extensions:
$ RENAME HT_ROOT:[SRC]PHP.DIR HT_ROOT:[SRC]PHP_nnn.DIR
Obtain the PHPWASD kit from (or one of the mirror sites)
http://wasd.vsm.com.au/wasd/
Using the CSWS PHP v1.3 PCSI kit location perform the following WASD build
$ @HT_ROOT:[SRC.PHP]INSTALL kit:[location]
Configure the Web server
Configure the PHP environment
Start scripting :^) Try the example scripts.
With the default configuration PHP script files are placed into [CGI-BIN] by the INSTALL.COM procedure (examples from [SRC.PHP]WEBSERVERSPY.PHP and the architecture dependent [PHP.AXP.SCRIPTS]*.PHP or [PHP.IA64.SCRIPTS]*.PHP ).
When you're satisfied you want to keep it add
$ @HT_ROOT:[SRC.PHP]PHP_STARTUP.COM(or the equivalent) to your system/Web startup procedures
# HTTPD$CONFIG
[DclScriptRunTime]
.PHP @CGI-BIN:[000000]PHPWASD.COM
[AddType]
.INI text/plain initialization file
.PHP text/plain PHP source
.PHPS text/plain PHP source
.PHTML text/plain PHP source
# HTTPD$MAP for CGI, CGIplus or RTE usage (perhaps for comparison)
exec /cgi-bin/* /cgi-bin/*
exec+ /cgiplus-bin/* /cgi-bin/*
exec /php-bin/* (@cgi-bin:[000000]phpwasd.com)/cgi-bin/* script=query=relaxed
# HTTPD$MAP for automatic RTE usage
map /cgi-bin/*.php* /php-bin/*.php*
exec /php-bin/* (@cgi-bin:[000000]phpwasd.com)/cgi-bin/* script=query=relaxed
set /**.php* script=query=relaxed
For scripts requiring extended file specification (EFS, located on ODS-5 volumes) the script path needs to be mapped as ODS-5.
set /**.php script=query=relaxed ods=5When a script environment is mapped as residing on an ODS-5 volume, any VMS-syntax file specifications contained in PATH_TRANSLATED and SCRIPT_NAME are automatically translated to Unix-style syntax. This has been demonstrated to better support PHP applications derived from such environments, in particular allowing relative directory references. This occurs whether or not the path is SET using script=syntax=unix.
For example; by default a request's underlying CGI variables might be:
REQUEST_URI /php-bin/php_info.php/ht_root/src/php/ PATH_INFO /ht_root/src/php/ PATH_TRANSLATED HT_ROOT:[SRC.PHP] SCRIPT_NAME /php-bin/php_info.php SCRIPT_FILENAME PHP-BIN:[000000]PHP_INFO.PHP
After mapping being on ODS-5 and subsequent translation they are presented as:
_SERVER["REQUEST_URI"] /php-bin/php_info.php/ht_root/src/php/ _SERVER["PATH_INFO"] /ht_root/src/php/ _SERVER["PATH_TRANSLATED"] /HT_ROOT/SRC/PHP/ _SERVER["SCRIPT_NAME"] /php-bin/php_info.php _SERVER["SCRIPT_FILENAME"] /PHP-BIN/000000/PHP_INFO.PHP
The PHPWASD engine
will by default chdir() to
the
Unix-style syntax equivalent of the directory containing the PHP script
file. It also does a setenv() against the environment
variable
PATH to this same string. This location may be explicitly provided
using the value of CGI variable SCRIPT_DEFAULT and set on a per-script
or general basis using the mapping rule set
script=default=<string> (minimum WASD v8.4.3). It will
accept
either VMS and Unix specifications depending on the requirements of the
script itself.
set /php-bin/mumble.php*
script=default="/mumble_device/000000"
set /php-bin/mumble.php* script=default="mumble_device:[000000]"
Defining the logical name PHPWASD$WATCH_SCRIPT_NAME
to contain a (case-sensitive) string from the SCRIPT_NAME variable.
$ define /system phpwasd$watch_script_name "php_info"
Defining the logical name PHPWASD$WATCH_REMOTE_ADDR to contain the IP address of the "watching" browser.
$ define /system phpwasd$watch_remote_addr "192.168.0.2"
Adding the string "#watch" to the first line of the PHP script.
<?php #watch
echo "<h1><center>Testing the PHPINFO () function</center></h1><br>\n";
phpinfo (INFO_ALL);
?>
Having a string "#watch:remote_addr=..." in the first line of
the PHP script, specifying the IP address of the "watching" browser.
<?php #watch:remote_addr=192.168.0.2
echo "<h1><center>Testing the PHPINFO () function</center></h1><br>\n";
phpinfo (INFO_ALL);
?>
The author of
PHPWASD is only a PHP novice, so anything in this
section should be taken with a large pinch of salt. Any scripting
environment should be approached with due caution and diligence.
Please
ensure you are familiar with PHP and it's security requirements in
particular before betting the company on anything in this section.
The PHP engine has a set of default configuration parameters and so can be used without specific configuration. This not a tutorial on which changes should be made for any give circumstance, just how to pass those changes into the PHPWASD scripting engine. To change the defaults a configuration file PHP.INI should be provided. The default location of this for CSWS and WASD is
PHP_ROOT:[000000]PHP.INIA default version is provided in
HT_ROOT:[SRC.PHP]PHP.INIand may be copied to the above location.
$ DEFINE PHPWASD$INI NL:
short_open_tag=1 ; expose_php=0 ; include_path="/php/application3/include"
$ define phpwasd$inis -
"short_open_tag=1 ; expose_php=0 ; include_path=""/php/application3/include"""
Parameter
Name |
Purpose |
---|---|
PHP_INI |
Provides the location for
the primary PHP.INI configuration file. |
PHP_INI2 |
Provides the location for
the secondary PHP.INI configuration file. |
PHP_INIS |
Allows the specification
of a
value for any of the configuration directives allowed in PHP.INI.
The format for these parameters is name="value"[;name="value"], where a
semi-colon is used to separate directives. See examples below. |
set /php/application_a/* script=param=(PHP_INI="php:[application_a]php.ini")
set /php/application_b/* script=param=(PHP_INI2="php:[application_b]php.ini")
# continuation lines used for printed page clarity
set /php/application_c* script=param=(PHP_INIS=\
'short_open_tag=1 ; expose_php=0 ; include_path="/php/application_c/include"')
After configuration the following scripts may be used to confirm the environment is functioning.
The performance of PHPWASD is quite respectable. This table shows some results on an AlphaServer 4100 5/400, running VMS V7.3-2, HP TCP/IP Services 5.4, with WASD 9.0 and PHPWASD v1.3, CSWS 1.3 and CSWS PHP 1.2, using the ApacheBench tool.
Environment | Path | Req/Sec |
---|---|---|
WASD CGI | /cgi-bin/php_info.php /cgi-bin/php_rules.php |
6 9 |
WASD RTE | /php-bin/php_info.php /php-bin/php_rules.php |
62 82 |
CSWS mod_php | /php/php_info.php /php/php_rules.php |
14 16 |
The PHPWASD.EXE engine interface is only suitable for scripting use. It cannot be used outside of the CGI environment and certainly not from the command line. It is often useful to have a PHP tool that can be used in such a manner and the CSWS kit provides one. To access this image assign a symbol (foreign command) in the (SY)LOGIN.COM procedure.
$ PHP = "$HT_ROOT:[PHP.BIN]PHP.EXE"This could also be used as a non-persistent CGI scripting engine if desired.
The PHPWASD kit
comes with object code that allows the image to be
linked against the CSWS PHP shareable image. To compile the
PHPWASD
image at least the CSWS PHP header files are required. Basically
this
means the full source kit needs to be installed.
http://h71000.www7.hp.com/openvms/products/ips/apache/csws_source.htmlCheck the BUILD_PHPWASD.COM procedure for detail. Note that the CSWS PHP v1.2 source kit must be located on an Extended File System (ODS-5) volume.
Unfortunately the author of the PHPWASD interface is such a PHP novice he is not in any position to answer queries about PHP "programming" or usage. If there's an obvious behavioural problem with PHPWASD (preferably diagnosed by someone with PHP experience) then he's it though.
Thanks to OpenVMS Engineering and the CSWS team for their efforts on PHP and Web technologies in general. Thanks also to the efforts of Dave Jones with his PHP port (usable with PHPWASD v1.0). Of course, thanks to the PHP development team!