Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Oracle UTF8

Hi.

I have a problem working with oracle, I've got everything running but the charset. My config looks like this:

'orcdatabase' => array( 'dbname' => '(DESCRIPTION = (ADDRESSLIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.X.XX)(PORT = 1521)))(CONNECTDATA = (SERVICENAME = xe)))', 'username' => 'user', 'password' => 'password', 'options' => [PDO::ATTRCASE => PDO::CASELOWER, PDO::ATTRPERSISTENT => TRUE], ),

And it works. If I add the option (right below password, as seen here https://forum.phalconphp.com/discussion/378/oracle-database-connection-error)

'charset' => 'AL32UTF8',

Or

'charset' => 'UTF8',

The app immeaditely breaks, and nothing gets written in the error log. I checked the oracle database and the charset is set to AL32UTF8 and supports spanish characters

Any help will be much appreciated

Thanks.

Ronald



1.6k
Accepted
answer

Ok, I figured it out. I'm writing it here in case someone else is looking for this.

What I needed to do was set the charset for the Oracle instant client, to do this, You can add them to the apache envvars or if your using php-fpm, the fpm script, like this:

ORACLEHOME=/opt/oracle/instantclient NLSLANG=SPANISHSPAIN.AL32UTF8 NLSTIMESTAMPFORMAT="YYYY-MM-DD HH24:MI:SS" NLSDATEFORMAT="YYYY-MM-DD" NLSDATELANGUAGE=SPANISH NLSTIMEFORMAT="HH24:MI:SS" export ORACLEHOME NLSLANG NLSTIMESTAMPFORMAT NLSTIMEFORMAT NLSDATELANGUAGE NLSDATE_FORMAT

Obviously you have to change the values to whatever you need. Hopefully It will help someone else.