php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48672 ORA-12705 when using NLS_LANG
Submitted: 2009-06-24 09:11 UTC Modified: 2009-06-24 15:08 UTC
From: dima at dimych dot sumy dot ua Assigned:
Status: Not a bug Package: OCI8 related
PHP Version: 5.2.10 OS: FreeBSD 6.4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dima at dimych dot sumy dot ua
New email:
PHP Version: OS:

 

 [2009-06-24 09:11 UTC] dima at dimych dot sumy dot ua
Description:
------------
I`m trying to connect from my FreeBSD box using oracle8 client (from freebsd-ports) to Oracle 8.1.7 server.
oci_new_connect fails when setting NLS_LANG environment variable. Without setting NLS_LANG connection successful. Perl script with same parameters successfully connects.



Reproduce code:
---------------
PHP script:
<?php
putenv('ORACLE_HOME=/usr/local/oracle8-client');

//putenv('NLS_LANG=RUSSIAN_CIS.CL8KOI8R');
putenv('NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1');

$dbh = oci_new_connect('user', 'pass', 'DBNAME');

var_dump($dbh);
var_dump(OCIError());

?>

Perl script:

#!/usr/bin/perl
use DBI;

BEGIN {
    $ENV{ORACLE_HOME} = '/usr/local/oracle8-client';
#    $ENV{NLS_LANG} = 'RUSSIAN_CIS.CL8KOI8R';
    $ENV{NLS_LANG} = 'AMERICAN_AMERICA.WE8ISO8859P1';
}

$dbh = DBI->connect("dbi:Oracle:DBNAME", "user", 'pass', {AutoCommit => 1, PrintWarn => 1, PrintError => 1})
    or die $DBI::errstr;

print $dbh;
print "\n";


Expected result:
----------------
successful connection:
bool(true)

Actual result:
--------------
PHP result:
bool(false)
array(4) {
  ["code"]=>
  int(12705)
  ["message"]=>
  string(59) "ORA-12705: invalid or unknown NLS parameter value specified"
  ["offset"]=>
  int(0)
  ["sqltext"]=>
  string(0) ""
}
end
Segmentation fault: 11 (core dumped)

Perl result:
DBI::db=HASH(0x8224024)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-24 15:08 UTC] sixd@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

----

Oracle environment variables must be set prior to PHP starting.  
Otherwise different, inconsistent values can be used by Oracle libraries 
at initialization and runtime.

Never, ever set ORACLE_HOME or NLS_LANG with putenv() in a PHP script.  
I'd also recommend the same for Perl and other dynamic languages: you 
are seeing unpredictable behavior.

See "Where do I set Oracle environment variables?" in 
http://wiki.oracle.com/page/PHP+Oracle+FAQ
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 17:01:30 2024 UTC