0PHP: Hypertext Preprocessor: WASDFDPHP: Hypertext Preprocessor: WASD1
 PHPWASD v1.1.0, 1st January 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 aM~10x (yes, an approximately ten 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.


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 PCSI kit from¤
      http://www.openvms.compaq.com/openvms/products/ips/apache/csws_php.html
    A

  4. Install the CSWS kit (partial) and perform the WASD build6
      $ @HT_ROOT:[SRC.PHP.WASD]INSTALL kit:[location]
    FNote that this performs a link-only build - fullbuild instructions.>

  5. Configure the Web serverB

  6. Configure the PHP environment'

  7. 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.WASD]WEBSERVERSPY.PHP and[PHP.SCRIPTS]*.PHP).5

  8. When you're satisfied you want to keep it add+
      $ @HT_ROOT:[SRC.PHP.WASD]PHP_STARTUP
    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  [ScriptRunTime]#  .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 10% of CGI (yes, that's correct,Oby a factor 10). 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.

  # HTTPD$MAP for RTE usage4  # this configuration probable works as well as any%  map /cgi-bin/*.php* /php-bin/*.php*:  exec+ /php-bin/* (cgi-bin:[000000]phpwasd.exe)/cgi-bin/*


orI

  # 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/*
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)./

  set /web/**.php* script=as=OTHER-ACCOUNT!  exec+ /web/**.php* /web/**.php*
"


Configure PHP
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 inP
  HT_ROOT:[SRC.PHP.WASD]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.

%


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!(