Open-source Languages & Tools for z/OS

 View Only
  • 1.  Accessing DB2 using PHP 7

    Posted 11-07-2018 06:59

    I would like to use PHP 7 scripts to access DB2 on z/OS.
    Is it possible and if so, are there some config guidelines to make it work?
    I used to have access to DB2 when using PHP5 on the old Domini Go Webserver,
    but now using the Apache-based http-server I don’t seem to get things working.

    Regards,

    MarcO64



  • 2.  RE: Accessing DB2 using PHP 7

    ROCKETEER
    Posted 11-20-2018 01:55

    Hi,

    Since the current version of IBM HTTP Server admits only EBCDIC-encoded
    headers, build 008 makes CGI output encoding controlled by environment
    variables:
    CGI_HEADER_ENCODING - for headers
    CGI_BODY_ENCODING - for all data excepting headers
    Possible values for these environment variables are:
    EBCDIC - force EBCDIC-encoded output
    ASCII - force ASCII-encoded output
    NONE - no data conversion

    Recommended settings for IBM HTTP Server are in Apache configuration file:

    CharsetSourceEnc ISO8859-1
    CharsetDefault ISO8859-1

    Also recommended to set following environment variables:

    export CGI_HEADER_ENCODING=EBCDIC
    export CGI_BODY_ENCODING=NONE
    export _BPXK_AUTOCVT=ON

    These environment variables can be set in Apache configuration file, e.g.

    SetEnv CGI_HEADER_ENCODING EBCDIC
    SetEnv CGI_BODY_ENCODING NONE
    SetEnv _BPXK_AUTOCVT ON

    or in PHP CGI wrapper script, e.g.

    #!/bin/sh
    export CGI_HEADER_ENCODING=EBCDIC
    export CGI_BODY_ENCODING=NONE
    export _BPXK_AUTOCVT=ON
    /rsusr/rocket/bin/php-cgi “$@”

    To run php with IBM DB2 ODBC driver provide necessary dynamic link libraries
    using STEPLIB environment variable, e.g.

    export STEPLIB=DSN1110.SDSNEXIT:DSN1110.SDSNLOAD:DSN1110.SDSNLOD2

    The path to ODBC connection initialization (INI) file can be set with DSNAOINI
    environment variable

    export DSNAOINI=/path/to/ini_file

    This file should be EBCDIC-encoded, tagged as binary and contain

    CURRENTAPPENSCH=ASCII

    Thanks,
    Sergey