TOC Previous Next
Globalization configuration (single-byte)
This section details the configuration required to enable PHP to display non-English languages and extract such data from DB2 for i5/OS. We continue the use of Russian in these examples and focus on using UTF-8 to enable the support, which is perhaps the most popular method used.
| Restriction: Currently it is mandatory to be signed on with the QSECOFR user profile (not just a profile having *SECOFR authority) for the following support to work. This is due to the way Apache security code is written. |
i5/OS
As described earlier, change the i5/OS job to be configured for the Russian language:
CHGJOB LANGID(RUS) CNTRYID(RU) CCSID(1025)
This is the only thing that has to be done in i5/OS. Remember that you have to be signed on as QSECOFR to make this work.
i5/OS PASE
We need to manually change some settings in the i5/OS PASE environment to configure UTF-8 support, because the default mappings used by the operating system when the new i5/OS PASE environment is started are ASCII rather than UTF-8.
Start an i5/OS PASE terminal:
CALL PGM(QP2TERM)
Issue the following commands to change from an ASCII environment to a UTF-8 one:
export QIBM_PASE_CCSID=1208
export PASE_LANG=RU_RU
export LANG=RU_RU
You can change PASE_NLSPATH and NLSPATH, although they are not mandatory modifications.
You should now be able to execute the env command and see your changes reflected in the i5/OS PASE environment.
PHP
Edit the main PHP configuration file, either via the administration console or directly by editing it manually.
We use Notepad to edit the file, which you can find (php.ini) in the following directory:
/usr/local/Zend/core/etc
You will find a default_charset directive there that is commented out. Copy it, remove the comment (semicolon) from the front, and change the value to "UTF-8." It should look like this:
default_charset = "UTF-8"
Apache
Special configuration is not required in the Apache environment. However, we cannot use the menu options provided by Zend (GO ZENDCORE/ZCMENU) to stop and start the PHP environment because they do not correctly configure the i5/OS PASE environment.
Fortunately, we can take advantage of an easy-to-use command called apachectl.
First, issue the following command:
cd /usr/local/Zend/apache2/bin
Now you can issue the following commands:
apachectl -k start to start apache server,
apachectl -k stop to stop apache server or
apachectl -k restart to restart apache server
This should get the PHP server going with the desired configuration.
Tip: You can imbed the following code in a PHP file to see the i5/OS PASE environment settings that the PHP engine is running in:
<?php
phpinfo (INFO_ENVIRONMENT);
?> |
DB2 for i5/OS
After you have performed all of the configuration steps outlined in this section, you should be able to extract text data from DB2 for i5/OS that is encoded in EBCDIC, UTF-8, or Unicode and have it display correctly (as long as the target browser has the correct fonts available).
TOC Previous Next