Very big problem with UTF-8/AL32UTF8 (PHP, Oracle XE - AL32UTF8)
693204Mar 27 2009 — edited Jan 19 2011Dear All,
I have a big problem getting PHP & Oracle XE with UTF8 (AL32UTF8) to work on a Windows 2003 Server. By now I read felt thousands of documents and tried almost everything (but obviously not the correct one :-))
I'm struggling with this for over almost 2 weeks now so here are lots of things I tried so far.
The problem:
I followed the Globalisation document from Oracle for PHP. When I submit in my HTML form a multibyte character like the German extra characters or any Arabic characters, they will be stored in the database as 0xFD (displayed square) and when I read it out, PHP shows me "?????"
Now you will say, "Man, check out NLS_LANG"...I tried that in lots of different ways, but no luck.
Configuration of the "problem-server":
Windows 2003 Server R2 Enterprise x64
PHP Zend for Oracle 5.2.5
Oracle XE Universal 10.2.0
Apache 2.2.4
I have enough servers & workstations around me, so I tried doing the same on another Windows 2003 Server, one XP machine and one Vista machine and from scratch it worked perfectly fine on all 3 machines.
I aligned all settings accross 4 installations and only this particular Windows 2003 server is doing it wrong.
I aligned:
Windows: Regional settings
Oracle: database characterset AL32UTF8
PHP: default_charset="UTF-8"
Apache httpd.conf: AddDefaultCharset utf-8
I tried for NLS_LANG (as environment variable and in Registry and with SetEnv in httpd.conf - Apache)
- AMERICAN_AMERICA.AL32UTF8 (recommended by Oracle Globalisation document because my HTML/PHP form submits already UTF8 conform data)
- AMERICAN_AMERICA.WE8MSWIN1252
- AMERICAN_AMERICA.AR8MSWIN1256
The PHP script is properly set to UTF-8 as well (copy paste from the Oracle Globalisation script) and due to the tests on the 3 other machines I could proof that it works...normally.
I tried for OEMCP (codepage setting in registry): 437 and 850 and 720 (Arabic chars)
I tried for ACP (GUI codepage setting in registry): 1252 and 1256
I ensured that the Apache www user has access to the Oracle directory and especially the nls-directory.
ORACLE_HOME is defined (not really required when using Zend for Oracle)
ORA_NLS10 is set
I tried also to install Oracle XE client and defined the path properly.
To make things more worse, I re-installed Apache, PHP Zend and Oracle XE, but also no luck
Thru Oracle SQL Developer I can enter the multi-byte characters into the database correctly.
The 3 other test installations went easy:
Installed Apache
Installed PHP Zend for Oracle
Installed Oracle XE
Set NLS_LANG to AMERICAN_AMERICA.AL32UTF8
(no other changes or settings made!)
Server Restart -> works!
For me, it looks pretty much like a problem with the characterset/NLS_LANG, but I have no idea what to do anymore....
My apologizes if the above is a bit confusing - in case I missed some important infos for you, just let me know!
Thank you very much!
Fabian