Oracle 11g PHP oci_connect fails OCIEnvNlsCreate() -


problem: linux centos/oracle 11g/instantclient/php 5.3.3

error: oci_connect(): ocienvnlscreate() failed. there wrong system - please check oracle_home , ld_library_path set , point right directories

phpinfo() relevant sections:

enter image description here

enter image description here

enter image description here

as see, environment variables correctly set, , can echo them on page with getenv(). checked read permissions , can read files in these directories webpage. client library files there (i installed , reinstalled twice) full install. libraries readable , loadable.

ldd did not show errors.

here call php file:

$test = getenv('ld_library_path')."  ".getenv('oracle_home'); $this->dbconn = oci_connect("myuser","mypassword", "localhost/orcl") or die("<b>connection failed: $test </b>").oci_error(); 

i tried tricks found googling, nothing worked.
appreciated.

got ocienvnlscreate() failed? welcome hell...

i know thread old, problem still present. , answers problem redirect third party sites, 404s .

let's start problem. error pretty generic. documentation sums "lib crashed...dunno why". there wide range of solutions including, not limited configuring, reinstalling , praying "insert random god name here".

here short list of common solutions:

1. put variable in .php file.

    putenv("ld_library_path=$newld");  $newld link library. 

2. remove variable ld_library_path, if exists(yeah, way shown in 1.), php file , place apache2.conf or httpd.conf or /etc/environment or whatever file distribution/version has environment variables. simple guide can found here or everywhere on internet. why?

do not set oracle environment variables using putenv() in php script because oracle libraries may loaded , initialized before script runs. variables set putenv() may cause conflicts, crashes, or unpredictable behavior. functions may work others might give subtle errors. variables should set before web server started.

as stated in installation docs. restart apache afterwards. it's distribution/version based, command service httpd restart.

  1. reinstall oci8. many times take. don't force it. forcing makes worse. also, try compile (aka download package use ./configure -'all fancy commands you'll need use' , make install).

  2. make sure u got right ld_library_path. funny thing say, right? didn't notice oracle created folder client/lib/ in n different locations contains more or less same files, , difference, between them, choosing 1 of folders result in mentioned error. sanity check?

  3. reinstall php/apache. it's probable had old installation causing issues. use apt-get purge php* or yum remove php* or whatever same trick distribution, start.

edit after php upgrade problem reoccurred, time different solution.

  1. edit sysconfig edit file /etc/sysconfig/httpd. add 2 lines @ end:

    export ld_library_path=/path/to.lib export oracle_home=/path/to/home

  2. give , read manual can found here.

if none of things help, feel free browse wall of sorrow, solution...


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -