0PHP: Hypertext Preprocessor: WASDFDPHP: Hypertext Preprocessor: WASD.
 PHPWASD v1.1.2, 18th May 2002

(
L

This is an interface to a PHP interpreter engine and environment for theNWASD OpenVMS Web server. It is designed to be able to be used in standard CGIKand CGIplus/RTE persistent scripting modes. The persistent modes provide aN~7x (yes, an approximately seven times) improvement in script activation timesOand reduced load on server and system. PHPWASD cannot be used interactively orOat the command line, it is only for scripting use. Note that this package doesMnot contain the PHP engine, that has to be obtained and installed separately.G

PHPWASD is linked against the CSWS (OpenVMS Apache) PHP interpreterIshareable image (although other comparable versions and images should be Jpossible, including the original CSWS PHP 1.0). It is anticipated that asObugfixed and improved (or at least later) versions of these OpenVMS PHP enginesKbecome available the PHPWASD interface will only require a relink to update(that's the plan anyway :^).M

Currently CSWS PHP is Alpha (AXP) only. The release notes state a minimumOrequirement of VMS V7.2-2. PHPWASD has been developed and tested on VMS V7.3-1.(

NOTE
*
,There is an issue with the CSWS v1.1 PHP kit(
  CPQ-AXPVMS-CSWS_PHP-V0101--1.PCSI
Bcontains an initialization bug and requires the application of the1
  CPQ-AXPVMS-CSWS_PHP11_UPDATE-V0100--4.PCSI
;patch kit available from the HP OpenVMS site to be applied.3See
Installation below.*



PHPWASD v1.1
I

For those who have used PHPWASD v1.0, please note that this kit has aKsignificantly different structure in line with changes introduced with WASDMv8.1. This effectively decouples the source and executable components of thekits.

4+)O%N)N)/
DirectoryPurpose
HT_ROOT:[SRC.PHP]Source code for PHPWASD. Contains nothing from the CSWS PHP kit.
HT_ROOT:[PHP]Location of PHP_ROOT logical name. Executable components of the scriptingJenvironment (e.g. PHPSHR.EXE, extension shareable images). The [.SCRIPTS]Ndirectory could be used for .PHP files with appropropriate mappings.
HT_ROOT:[CGI-BIN]Contains the .PHP script files. This may be changed (to [PHP.SCRIPTS] for example) via mappings.
HT_ROOT:[AXP-BIN]PHP interface; PHPWASD.EXE image.



#CSWS (OpenVMS Apache)
@

Currently (CSWS PHP V1.1) based on PHP 4.1.1. The procedureLINSTALL.COM will use the PCSI kit as a source of required files, extractingNand installing them in a HT_ROOT:[PHP] directory tree (that parallels the CSWSOtree). The following files are extracted from the CSWS PHP kit and placed intoIthe WASD directory structure. Of course there is no reason why this treeAcannot be relocated (with appropriate startup procedure changes).

4'CFOI
CSWS_PHPWASD
[APACHE.PHP.BIN]PHP.EXEHT_ROOT:[PHP.BIN]
[APACHE.PHP.BIN]PHPSHR.EXEHT_ROOT:[PHP.BIN]
[APACHE.PHP.EXTENSIONS]*.EXEHT_ROOT:[PHP.EXTENSIONS]
[APACHE.PHP.SCRIPTS]*.PHPHT_ROOT:[PHP.SCRIPTS]
I

The CSWS PHP 1.1 kit contains a significant number of PHP extensions:

FBCMATH  BZ2  CALENDAR  CTYPE  DBA  EXIF BFTP  ICONV  LDAP  MHASH  OCI8  ODBC MOPENSSL  ORACLE  PCRE  POSIX  SESSION  SOCKETS XML  ZIP  ZLIB
:(shareable images in the format PHP_extension.EXE).!


Installation


    M
  1. It is suggested that any exisiting PHPWASD kit be renamed out of the wayFbefore installing this kit so there can be no interactions between kitDcontents. After successful installation the old kit may be deleted.;
      $ RENAME HT_ROOT:[SRC]PHP.DIR HT_ROOT:[SRC]PHP10.DIR
    @

  2. Obtain the WASDPHP kit from (or one of the mirror sites)N
      http://wasd.vsm.com.au/wasd/
    +and install it as per the kit instructions.@

  3. Obtain the CSWS_PHP and CSWS_PHP11_UPDATE PCSI kits from¤
      http://h71000.www7.hp.com/openvms/products/ips/apache/csws_patches.html
    %

  4. Install the CSWS PHP v1.1 kit,(CPQ-AXPVMS-CSWS_PHP-V0101--1.PCSI)and perform the WASD build1
      $ @HT_ROOT:[SRC.PHP]INSTALL kit:[location]
    FNote that this performs a link-only build - fullbuild instructions.)

  5. Apply the CSWS PHP 1.1 update kit5(CPQ-AXPVMS-CSWS_PHP11_UPDATE-V0100--4.PCSI);
      $ @HT_ROOT:[SRC.PHP]INSTALL UPDATE111 kit:[location]
    >

  6. Configure the Web serverB

  7. Configure the PHP environment'

  8. Start scripting  :^) 7Try the example scripts.J

    With the default configuration PHP script files will need to be placed;into [CGI-BIN] (examples from [SRC.PHP]WEBSERVERSPY.PHP and[PHP.SCRIPTS]*.PHP).5

  9. When you're satisfied you want to keep it addH
      $ @HT_ROOT:[SRC.PHP]PHP_STARTUP.COM
    9(or the equivalent) to your system/Web startup procedures
#


Configure WASD
M

Server global configuration (HTTPD$CONFIG) is used to indicate which fileLtypes should activate the PHP interpreter and how perform non-script access.

  # HTTPD$CONFIG  [DclScriptRunTime]#  .PHP $CGI-BIN:[000000]PHPWASD.EXE  [AddType](  .INI   text/plain  initialization file  .PHP   text/plain  PHP source  .PHPS  text/plain  PHP source  .PHTML text/plain  PHP source
N

There are various ways to employ the WASD PHP interpreter. It can be usedOin vanilla CGI mode, or in persistent CGIplus/RTE mode. Benchmarking indicatesOthe CGIplus/RTE use reduces activation time to 15% of CGI (yes, that's correct,Nby a factor 7). There are subtle differences in the way CGIplus and RTE parseLand provide the PATH_INFO data. See the "WASD Scripting Overview"Hfor more detail. The following rules require the PHP script files to beIlocated in the site administrator controlled /cgi-bin/ path. This may be changed using appropriate rules.I

  # HTTPD$MAP for CGI, CGIplus or RTE usage (perhaps for comparison):  exec+ /php-bin/* (cgi-bin:[000000]phpwasd.exe)/cgi-bin/*  ..  exec /cgi-bin/* /cgi-bin/*!  exec+ /cgiplus-bin/* /cgi-bin/*
J

or, to automatically map scripts ending in ".php" to the RTEengine*

  # HTTPD$MAP for automatic RTE usage>  if (!script-name:/php/*) map /cgi-bin/*.php* /php-bin/*.php*9  exec /php-bin/* (cgi-bin:[000000]phpwasd.exe)/cgi-bin/*  ..  exec /cgi-bin/* /cgi-bin/*!  exec+ /cgiplus-bin/* /cgi-bin/*
N

The following rules allow .PHP type files anywhere in the mapped directoryOstructure to be executed. This means that any document author can script usingNPHP. This may be what is desired but can be dangerous. PHP provides for thisFtype of usage. Please familiarise yourself with it's requirements andIcontrols. As an additional safeguard it is suggested that PHP scripts beKexecuted under a non-server account. This is the default configuration forNWASD v8.1 and later. If not using the default setup it can also be done usingHthe WASD PERSONA capabilities (see the "Technical Overview" if6unfamiliar with this functionality and configuration).<

  exec+ /web/*.php* /web/*.php* script=as=OTHER-ACCOUNT
K

By default WASD validates query strings in it's ownNinimitable fashion (correctly in the author's HO). This validation interferesJwith the requesting of the internally generated PHP and Zend logos (as areEincluded by the php_info.php script). To disable query stringIvalidation by WASD include the following HTTPD$MAP rule at an appropriate'location before mapping of PHP scripts.(

  set /**.php* script=query=relaxed
"


Configure PHP
3

See NOTE with introduction.K

The author of PHPWASD is only a PHP novice, so anything in this sectionMshould be taken with a large pinch of salt. Any scripting environment shouldMbe approached with due caution and diligence. Please ensure you are familiarHwith PHP and it's security requirements in particular before betting the$company on anything in this section.N

The PHP engine has a set of default configuration parameters and so can beMused without specific configuration. To change the specifics a configurationMfile name PHP.INI may be provided. The default location of this for CSWS andWASD is

  PHP_ROOT:[000000]PHP.INI
A default version is provided inF
  HT_ROOT:[SRC.PHP]PHP.INI
(and may be copied to the above location.$


Example Scripts
H

After configuration the following scripts may be used to confirm theenvironment is functioning.




Performance
K

The performance of PHPWASD is quite respectable. This table shows someOresults on the author's development system, a Digital AlphaStation 500/333 withM1 CPU and 256MB running VMS V7.3-1, with WASD 8.1, CSWS 1.3 and CSWS PHP 1.1,Ausing the ApacheBench tool.

4:&&"""
EnvironmentPathReq/Sec
WASD CGI/cgi-bin/php_info.php
$/cgi-bin/php_rules.php
5
6
WASD RTE/php-bin/php_info.php
$/php-bin/php_rules.php
34
52
CSWS mod_php/php/php_info.php
/php/php_rules.php
15
18
%


Command-line PHP
L

The PHPWASD.EXE engine interface is only suitable for scripting use. ItHcannot be used outside of the CGI environment and certainly not from theOcommand line. It is often useful to have a PHP tool that can be used in such aKmanner and the CSWS kit provides one. To access this image assign a symbol1(foreign command) in the (SY)LOGIN.COM procedure.*

  $ PHP = "$HT_ROOT:[PHP.BIN]PHP.EXE"
O(This can also be used as a CGI scripting engine if desired. See PHPWASD.C fordetail.)


Full Build
M

The PHPWASD kit comes with object code that allows the image to be linkedPagainst the CSWS PHP shareable image. To compile the PHPWASD image at least theMCSWS PHP header files are required. Basically this means the full source kit1needs to be installed. This may be obtained fromª

  http://www.openvms.compaq.com/openvms/products/ips/apache/csws_source.html
Jand by default should be placed in HT_ROOT:[SRC.PHP.PHP...] although it is>possible to build with it located elsewhere. Please check theGBUILD_PHPWASD.COM procedure for detail.


Problems?


M

Unfortunately the author of the PHPWASD interface is such a PHP novice heMis not in any position to answer queries about PHP "programming" orJusage. If there's an obvious behavioural problem with PHPWASD (preferably>diagnosed by someone with PHP experience) then he's it though.$


Acknowlegements
L

Thanks to OpenVMS Engineering and the CSWS team for their efforts on PHPOand Web technologies in general. Thanks also to the efforts of Dave Jones withFhis PHP port (usable with PHPWASD v1.0). Of course, thanks to the PHPdevelopment team!(


ÿÿryString, RefererString, UserAgentString, ResponseString, ResponseMinSizeString, ResponseMaxSizeString, DurationHr, DurationMin, DurationSec, RecordCountTotal, SuspectRecordCountTotal, CommonLogRecordCount, CombinedLogRecordCount, RequestCountTotal, MethodConnectCount, MethodDeleteCount, MethodGetCount, MethodHeadCount, MethodPostCount, MethodPutCount, MethodUnknownCount, StatusCodeCount[1], StatusCodeCount[2], StatusCodeCount[3], StatusCodeCount[4], StatusCodeCount[5], StatusCodeCount[0], ByteStringPtr, ByteString); } /****************************************************************************/ /* */ void CgiForm () { char *cptr; /*********/ /* begin */ /*********/ if (Debug) fprintf (stdout, "CgiForm()\n"); /* make a guess at the log file defaults */ if (CgiLibEnvironmentIsWasd()) cptr = DEFAULT_LOGS_WASD; else if (CgiLibEnvironmentIsOsu()) cptr = DEFAULT_LOGS_OSU; else if (CgiLibEnvironmentIsApache()) cptr = DEFAULT_LOGS_APACHE; else cptr = DEFAULT_LOGS_FILESPEC; CgiLibEnvironmentPtr = CgiLibEnvironmentName(); CgiScriptNamePtr = CgiLibVar ("WWW_SCRIPT_NAME"); sys$fao (&StartDateTimeFaoDsc, NULL, &StartDateTimeDsc, 0); if (StartDateTime[0] == ' ') strcpy (StartDateTime, StartDateTime+1); CgiLibResponseHeader (200, "text/html"); fprintf (stdout, "\n\ \n\