Embedded PHP For PROGRESS

An experimental module that allows direct calling of PHP functions from PROGRESS 4GL

Overview

Download

PHP is a highly functional Open Source scripting language. EPP (Embedded PHP for Progress) is method of obtaining access to some of its rich functionality directly from PROGRESS programs. Access is achieved either from shared libraries, or by linking PHP using HLC. This initial, experimental, release provides access to many PHP functions that can extend the functionality of PROGRESS, and provide solutions to many of the areas where PROGRESS functionality is weak.

Current Functionaliy

  • Math Library - arc,cos,tan,bin2hex,exp etc. [approx 40 math functions]
  • String Library - strtoupper,strrev,crypt, metaphone [approx 60 string functions]
  • Perl Compatible Regular Expressions (regexp) - Pattern matching and replacing.

Current Release Status

EPP is currently in an experimental stage. Documentation is almost non-existent, and where it does exist, it may be incorrect. Here are a list of key files for the installation.

  • library/Makefile - A Makefile for building EPP as a shared library under UNIX. tested on Linux only.
  • library/Makefile.win32 - A Makefile for building a windows dll. Requires Microsoft VC6. Only required if you want to change the dll itself. A binary for windows is supplied.
  • library/phpdlc.dll - A Win32 dll for use with epp.
  • buildfunc.w - A Progress program to build epp procedures.
  • *.tpl template files for each type of function. I recommend using these as the buildfunc.w can auto-generate procedures for functions in these templates, and the probability that I will change the input/output requirements for these procedures is about 95%.
  • eppdlc.i - The dispatch routine for the library.
  • Look at the include files in epp/string, epp/math and epp/regexp_posix. All these functions were generated by buildfunc.w

Essential Documentation

Download the PHP manual. Use this as the basis for generating new procedures. Follow these guidelines.

  • If the function requires OR returns either a resource or an array it cannot currently be used in EPP. I hope this will change in the future. Mixed variables should be used with caution
  • If the function accepts a variable number of input parameters, you may need to create functions for each style. Remember that progress cannot pass variable numbers of procedures.
  • To prevent naming conflicts, preface the php function with epp_ to produce the epp procedure name.

Requirements

PHP version 4.3.1 or higher must be installed on the machine running EPP. A working web server is not required.

Installation

Windows

  1. Download a binary version of PHP. Copy the php4ts.dll file to the \windows\system32 directory, and the php.ini file to the \windows directory, and edit as per the php installation instructions.
  2. Copy the phpdlc.dll from the epp\library directory into the \windows\system32 directory.
  3. modify the eppdlc.i include file as required.

Unix

  1. Download the source code for PHP.
  2. run configure --embed=shared (plus any other options you need).
  3. run Make
  4. run Make install. This will install the libphp4.so.
  5. edit the Makefile in the epp/library directory as required.
  6. run Make
  7. copy the libphpdlc.so to the same directory as the libphp.so
  8. Under linux, its probably a good idea to run ldconfig.
  9. modify the eppdlc.i include file as required.

Examples

To use the PHP date function to produce a nicely formatted date:

			{epp/eppdlc.i}
			{epp/time.i}
			def var i as integer no-undo.
			def var c as character no-undo.

			/* get a timestamp from the PHP time function*/
			run epp_time(output i).
			/* now format it nicely using the PHP date function */
			run epp_date("l dS of F Y h:i:s A", i, output c).
			display c.
			

This would produce something like Wednesday 15th of January 2003 05:51:38 AM

Licensing

The Product is distributable as you wish compatible with the BSD license.

Hosted by www.Geocities.ws

1