z/OS Tools & Language

PHP from z/OS Apache WebServer

  • 1.  PHP from z/OS Apache WebServer

    Posted 11-22-2018 09:51

    I’m new to PHP so apologies if I get the technicals incorrect here.

    I am attempting to server html pages containing php (5.4.4) from Apache Web Server 9.0.0.6 (z/os 2.2). I have followed the IBM Redbook (HTTP migrating to Apache - Chapter 12.5) about running php cgi scripts, I’ve hit errors and fixed them but I’m now at the stage where there appear to be no errors but the page displays as the source script rather that the expected php.

    Access log extract

    21/Nov/2018:17:41:52 +0000¨ “GET /noSecurePhp/hello.php HTTP/1.1” 200 96 447157 +

    Error log extract

    1066¨ dgw_compat=-1, ce=0
    1066¨ should_translate_request returning OK
    1066¨ implicit add on output: implicit_add=0
    1066¨ xlate input filter not added implicitly because no input configuration available

    Screen contents
    /products/rocket/bin/php-cgi --php-ini /ihsconfig/ihs/ihsae001/cgi-bin/php.ini $SCRIPT_FILENAME

    If I amend the script to say only run php-cgi with no parms I see errors with PHP

    error.log extract

    1147¨ dgw_compat=-1, ce=0
    1147¨ should_translate_request returning OK
    1147¨ implicit add on output: implicit_add=0
    1147¨ xlate input filter not added implicitly because no input configuration available
    ‘noSecurePhp.sh’: Bad header: php-cgi Ýargs…

    I’m happy that php is installed ok. It’s working in Batch and the script i’m attempting to execute in HTTP works fine in OMVS.

    I have seen other posts but not convinced anything is applicable.

    The httpd.conf extract is:

    Alias /noSecurePhp/ /ihsconfig/ihs/ihsae001/cgi-bin/phpNoSecure/

    <Directory /ihsconfig/ihs/ihsae001/cgi-bin/phpNoSecure/>

    LogLevel trace8                                                                    
    

    Options +ExecCGI

    AddHandler indirect-noSecurePhp-script .php                                       
    
    Require all granted                                                                
    

    Action indirect-noSecurePhp-script /cgi-bin/noSecurePhp.sh

    ScriptAliasMatch /cgi-bin/noSecurePhp.sh /ihsconfig/ihs/ihsae001/cgi-bin/noSecurePhp.sh

    <Location /cgi-bin/noSecurePhp.sh>

    Options +ExecCGI

    SetHandler cgi-script

    The wrapper script is:

    #!/bin/sh

    /products/rocket/bin/php-cgi --php-ini /ihsconfig/ihs/ihsae001/cgi-bin/php.ini £SCRIPT_FILENAME

    Has anyone seen this before? Is there a better way to configure?

    Many thanks in advance.

    Andrew Davis