Products Resources Support About Us

Trying to get php 7.0.5 working

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

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

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

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

Yes I have set those.

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.

is required. Just tested.

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.

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.

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