[PHP-DEV] Re: [PHP3] Retrieving data from database (fwd) From: Thies C. Arntzen (thies <email protected>)
Date: 09/16/99

On Thu, 16 Sep 1999, Rasmus Lerdorf wrote:

> Just in case you don't read the php3 list. Interesting to get a note from
> an Oracle tech support manager.
>
> ---------- Forwarded message ----------
> Date: Thu, 16 Sep 1999 15:03:50 +0100
> From: Yura Gauchman <YGAUCHMA <email protected>>
> To: php3 <email protected>
> Cc: ruthy <email protected>
> Subject: [PHP3] Retrieving data from database
>
> Hello all,
> I am Yuri Gauchman, Oracle Israel National Language Support manager.
> One of our customers uses PHP3 +Apache Web Server to put/retrieve data to/from Oracle 8.0.4 database.
> He uses Oracle OCI API.
> The problem is that PHP3 retrieves regular English characters as UNICODE ones - two bytes for each character, i.e.
> A is 0A, B as 0B, C as 0C ...
> Questions:
> 1) As far as I understand PHP3 works with Oracle OCI interface.

yes, that's correct - PHP3 has a driver for the "old" <= Oracle7 API plus
one that uses the "new" OCI* calls.

> As Oracle database he uses is a single character one (Character
> set Iw8ISO8859P8) What makes PHP3 to retrieve data in UNICODE like
> character set?

that would be oracle - as PHP has no idea how to convert from Iw8ISO8859P8
to UNICODE! -

>
> 2) Usually OCI uses environment variable ORA_NLS32 (or ORA_NLS33)
> and NLS_LANG for proper character set conversion between Oracle OCI
> program on the client and Oracle Server. (ORA_NLS33 points to
> $ORACLE_HOME/ocommon/nls/admin/data)
> PHP3 retrieves the same UNICODE like data either independently
> either ORA_NLS33 exist or does not. The same with NLS_LANG environment
> variable. It looks very strange.
> Why the normal Oracle environment does not make any difference
> for PHP3?
> Should we reload WEB SERVER every time after changing of PHP3 script?

this sounds like the apache-process does *NOT* inherit the "right"
environment variables (NLS_LANG...).

again php does not touch the data it get from the oci-calls.

please try the following:

compile php as a standalone binary (with oracle support).

in yur shell:

myhost> sqlplus scott/tiger

SQL> select table_name from tabs;

... you should see the table_name field (in the right char-set) ...

SQL> exit

create a file called ocitest.php:
<?php
$con = ocilogon("scott","tiger");
$stmt = ociparse($con,"select table_name from tabs");
$err = ociexecute($stmt);
 
$numcols = ocinumcols($stmt);
 
while (ocifetch($stmt))
  echo ociresult($stmt,1)."\n";

 
ocifreestatement($stmt);
ocilogoff($con);
?>

and call it up like this:

myhost> /path/to/php ocitest.php

that should give you "more-or-less" the same result like the sqlplus session.

if that's the case we know that our environmet for our web-server is wrong
somehow - please check on that then!

please let us know how things go!

regards,
tc

PS: you don't need you service-number for that;-)

>
> P.S. The customer uses Oracle8 database with IW8ISO8859P8 charset, but not standard WE8ISO8859P1.
> Is it should be the problem?
>
> The best regards,
> Yuri.
>
> --
> PHP 3 Mailing List <http://www.php.net/>
> To unsubscribe, send an empty message to php3-unsubscribe <email protected>
> To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
> To search the mailing list archive, go to: http://www.php.net/mailsearch.php3
> To contact the list administrators, e-mail: php-list-admin <email protected>
>
>
>

Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!"
Digital Collections Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93 20097 Hamburg / Germany

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>