Products Resources Support About Us

PHP 7 character set issues



I managed to run PHP 7 in “CGI” mode, but I have an error in “FastCGI” mode that I can not solve:

[error] [client] FastCGI: incomplete headers (115 bytes) received from server “/local/basepro/m4stats/php/php.fcgi”, referer: http://tmvs:8080/

In Apache conf file I have :

CharsetSourceEnc IBM-1047
CharsetDefault ISO8859-1
AddType application/x-httpd-php .php

In the shell that runs the PHP script I have (both for CGI mode and FastCGI mode) :


PHP scripts and php.ini are IBM-1047 encoded.




Hi Denis,

Could you provide detailed description, I mean step by step?
Also could you create separated topic for your issue?




We think there is a problem in your environment, because now we are not able to reproduce this issue. I added short config, which we use in our work. Could you try to use it?

config.tar (10 KB)


Thanks Tatyana, I’ll have a look and implement any differences.

When you say “we are not able to reproduce” do you mean that…

  1. Calling an external REXX via exec() from a PHP 7 CGI returns displayable characters in the output array?
  2. Posting values back to a PHP 7 CGI results in the $_POST superglobal being populated correctly?
  3. File uploads using PHP 7 result in the file being uploaded correctly and both the $_POST and $_FILES superglobals are correctly populated?


Hi Tatyana,
I tried out the httpd.conf (which is http 8.5 based) you provided. I created an http 8.5 based test server for this.

As we use a directory cgi-bin I added

ScriptAlias /cgi-bin/ "/u/testhttp/server/cgi-bin/"

For PHP I added
SetEnv PHPRC /u/testhttp/server/conf

To be able to start and stop the server using MVS commands, I added:

LoadModule zos_cmds_module modules/

Then I tried a shell script, a REXX script and a simple PHP script. In all cases I get EBCDIC output in Firefox.

When trying out Richard’s exec1 I get

output[0]=hello world input one last line

Trying Richard’s testpost I also get EBCDIC garbage in Firefox.

Hm, being confused now as you said your httpd.conf did work.

– Manfred



One more detail. PHPRC should refer to php.ini file. This setting should be set in php.ini:



That setting is in our php.ini.

I am pretty sure that if PHPRC points to a directory it is assumed there is a php.ini in that directory.


Yes, you are right.
Which version of http server and z/OS do you use?


z/os 2.1, and in this case I used http 8.5 as your httpd.conf was built for 8.5


Hi Richard,

I meant all these scenarios works correctly in our system.


Is there any news on this problem? I also have POST values not returned in the correct codepage.


We have to prioritize our support for paying customers. Unfortunately, PHP is not in our schedule for 2018 and half of 2019.