z/OS Tools & Language

Expand all | Collapse all

Trying to get php 7.0.5 working

  • 1.  Trying to get php 7.0.5 working

    Posted 08-30-2017 11:48

    Hi all,
    I started out with a very small script:

    1. Test in a shell

    #!/ROCKET/php/bin/php-cgi
    <?php
    
    // show all information
    phpinfo();
    
    ?>
    

    in an untagged file with IBM-1047 encoding. File name is: /u/http/server/cgi-bin/phpinfo.IBM-1047

    In the shell I have set:
    export CGI_HEADER_ENCODING=EBCDIC
    export CGI_BODY_ENCODING=EBCDIC

    Now when calling /u/http/server/cgi-bin/phpinfo.IBM-1047 in the shell I get html output which looks good.

    2. Test using http server

    Now I have set:

    SetEnv CGI_HEADER_ENCODING EBCDIC
    SetEnv CGI_BODY_ENCODING EBCDIC 
    

    in httpd.conf

    When calling from browser:
    https://internal_server.com/cgi-bin/phpinfo.IBM-1047

    I get an internal error.

    Looking into httpd error log shows:

    [Wed Aug 30 15:45:51.959346 2017] [cgi:error] [pid 66289:tid 1742637969094737925] [client 9.164.183.117:60602] malformed header from script 'phpinfo.IBM-1047': Bad header: <b>Security Alert!</b> The PHP

    It could well be that the problem sits in front of my laptop. Dunno.

    Any help appreciated.

    – Thanks, Manfred



  • 2.  RE: Trying to get php 7.0.5 working

    Posted 08-30-2017 12:28

    Could it be that your browser doesn’t know that a IBM-1047 type file is and how to deal with it.
    php scripts usually end in .php or php5 and is a defined mime type.
    so since the browsers (or maybe the server) doesn’t know what IBM-1047 is you’re getting this message



  • 3.  RE: Trying to get php 7.0.5 working

    Posted 08-30-2017 13:55

    No! The script works with older php (if I have changed the shebang).



  • 4.  RE: Trying to get php 7.0.5 working

    Posted 08-31-2017 16:21

    Have you set:
    CharsetSourceEnc IBM-1047
    CharsetDefault ISO8859-1
    in your httpd.conf?



  • 5.  RE: Trying to get php 7.0.5 working

    Posted 09-01-2017 02:31

    Yes I have set those.



  • 6.  RE: Trying to get php 7.0.5 working

    Posted 09-01-2017 02:33

    Seems I have found the problem.

    I had to tag the php.ini as IBM-1047. Then things work fine. I should add that I also have set
    SetEnv _BPXK_AUTOCVT ON

    Not sure if this is really required.



  • 7.  RE: Trying to get php 7.0.5 working

    Posted 09-01-2017 03:07

    is required. Just tested.



  • 8.  RE: Trying to get php 7.0.5 working

    Posted 09-01-2017 06:51

    So the solution is:

    • environment variable _BPXK_AUTOCVT=ON is needed for reading tagged files (e.g. php.ini) properly,
    • php.ini is needed for setting directive cgi.force_redirect = 0.


  • 9.  RE: Trying to get php 7.0.5 working

    Posted 09-01-2017 10:48

    Yes.

    It is important to keep in mind what Peter Fandel this year said at some point in time: "We are gradually moving all our ports to work internally in ASCII but also support EBCDIC equally well. We are about 2/3rds the way there. "

    So, _BPXK_AUTOCVT=ON and tagging files is getting more and more important when using the Rocket Tools for z/OS.



  • 10.  RE: Trying to get php 7.0.5 working

    Posted 09-01-2017 15:34

    I agree.
    _BPXK_AUTOCVT=ON and tagging files are the parts of environment any program (not only Rocket Tools) should work in.