php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60154 OCIEnvNlsCreate() failed. please check that LD_LIBRARY_PATH includes ...
Submitted: 2011-10-27 21:31 UTC Modified: 2011-10-31 20:07 UTC
From: jiten dot luhar at gmail dot com Assigned:
Status: Not a bug Package: OCI8 related
PHP Version: 5.3.8 OS: AIX 6.1
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jiten dot luhar at gmail dot com
New email:
PHP Version: OS:

 

 [2011-10-27 21:31 UTC] jiten dot luhar at gmail dot com
Description:
------------
Hi,
I recently build following after lots of strugle.
Server: IBM
OS: AIX 6.1
Apache: 2.2.19
PHP: 5.3.8

To make sure I have installed all the pre-requisite using AIX RPM packages without any errors.

Configure command for Apache:
./configure --prefix=/opt/myenv/share --with-ssl=/usr/bin/openssl --enable-ssl --enable-setenvif --enable-rewrite --enable-so

I have downloaded Oracle Instace Client 11.1.0.7(Basic + SDK) and unziped at /opt/myenv/share/oracle

Configure Command for PHP:
./configure --prefix=/opt/myenv/share --with-config-file-scan-dir=/opt/myenv/share/etc/php.d --with-apxs2=/opt/myenv/share/bin/apxs  --host=powerpc-ibm-aix6.1.0.0 --with-zlib --with-zlib-dir=/opt/freeware --enable-libxml --with-libxml-dir=/opt/freeware --with-pcre-dir=/opt/freeware --with-mysqli=mysqlnd --with-oci8=instantclient,/opt/myenv/share/oracle


Now,
While connecting Oracle database, its giving me following error.

PHP Warning:  ociplogon() [<a href='function.ociplogon'>function.ociplogon</a>]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries


Surprisely, this error not Coming when i run PHP from SHELL script. It will comes when i run PHP using Apache on Browser.

I tried every solution that i found on all other BUGS/Website.

i.e.
File: /opt/myenv/share/bin/envvars

export LD_LIBRARY_PATH = /opt/myenv/share/oracle 

File: /opt/myenv/share/conf/httpd.conf

SetEnv LD_LIBRARY_PATH /opt/myenv/share/oracle
LoadModule php5_module        modules/libphp5.so


In phpinfo(), it shows LD_LIBRARY_PATH correctly in all sections where it should be. i.e. in ENVIRONMENT, in PHP Variables, In Apach Environment sections.

But still, i am having same error with NO LUCK !!!

[As i mentioned, i am not getting this error when executing same file from SHELL, and it connects to DB successfully]

Expected result:
----------------
OCI8 should able to find LD_LIBRARY_PATH.

/opt/myenv/share/conf/httpd.conf:
SetEnv LD_LIBRARY_PATH /opt/myenv/share/oracle
LoadModule php5_module        modules/libphp5.so

/opt/myenv/share/bin/envvars:
LD_LIBRARY_PATH="/opt/myenv/share/oracle"
export LD_LIBRARY_PATH

/opt/myenv/share/oracle:
-rw-rw-rw-    1 root    root           192 Sep 26 2008  SQLPLUS_README
-r--r--r--    1 root    root           342 Sep 26 2008  glogin.sql
-r-xr-xr-x    1 root    root      36838851 Sep 26 2008  libsqlplus.so
-r-xr-xr-x    1 root    root       1508116 Sep 26 2008  libsqlplusic.so
-r-xr-xr-x    1 root    root      36768154 Sep 26 2008  sqlplus
-r--r--r--    1 root    root      40210154 Sep 26 2008  libclntsh.a
-r--r--r--    1 root    root       6057596 Sep 26 2008  libocci.a
-r-xr-xr-x    1 root    root       4606923 Sep 26 2008  libocci.so
-r-xr-xr-x    1 root    root        714625 Sep 26 2008  libocijdbc11.so
-r--r--r--    1 root    root       1890499 Sep 26 2008  ojdbc5.jar
-r--r--r--    1 root    root       1988051 Sep 26 2008  ojdbc6.jar
-rw-rw-rw-    1 root    root           188 Sep 26 2008  BASIC_README
-rwxrwxrwx    1 root    root         52556 Sep 26 2008  adrci
-rwxrwxrwx    1 root    root         35546 Sep 26 2008  genezi
-r-xr-xr-x    1 root    root      39129029 Sep 26 2008  libclntsh.so
-r-xr-xr-x    1 root    root       4269968 Sep 26 2008  libnnz11.so
-rwxrwxrwx    1 root    root      82898597 Sep 26 2008  libociei.so



Actual result:
--------------
PHP Warning:  ociplogon() [<a href='function.ociplogon'>function.ociplogon</a>]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-10-27 22:34 UTC] sixd@php.net
Since this works in command line PHP there's no indication of a bug in any PHP 
code.  Please follow up on a support forum such at 
http://www.oracle.com/technetwork/forums/php/index.html
There are few things that could be looked at.
 [2011-10-27 22:34 UTC] sixd@php.net
-Status: Open +Status: Bogus
 [2011-10-31 20:07 UTC] sixd@php.net
For future readers: AIX uses LIBPATH to set the path.
 [2011-10-31 20:48 UTC] sixd@php.net
Automatic comment from SVN on behalf of sixd
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=318619
Log: OCI8: improve initialization error message (See bug 60154)
 [2011-11-04 15:52 UTC] jiten dot luhar at gmail dot com
Sorry, but LIBPATH is also defined to included oracle installations.

LIBPATH="/opt/myenv/share/lib:/opt/myenv/share/oracle:$LIBPATH"
export LIBPATH
LD_LIBRARY_PATH="/opt/myenv/share/lib:/opt/myenv/share/oracle"
export LD_LIBRARY_PATH

Also, in the php source, PHP/ext/oci8/oci8.c file uses LD_LIBRARY_PATH, not the LIBPATH

File: ext/oci8/oci8.c

....
/* For a user friendly message about environment setup */
/* TODO: add cases for SHLIB_PATH, LIBPATH, LD_LIBRARY_PATH_64 etc */
#if defined(PHP_WIN32)
#define PHP_OCI8_LIB_PATH_MSG "PATH"
#elif defined(__APPLE__)
#define PHP_OCI8_LIB_PATH_MSG "DYLD_LIBRARY_PATH"
#else
#define PHP_OCI8_LIB_PATH_MSG "LD_LIBRARY_PATH"
#endif

....
...

static void php_oci_init_global_handles(TSRMLS_D)
{
        sword errstatus;
        sb4   ora_error_code = 0;
        text  tmp_buf[PHP_OCI_ERRBUF_LEN];

        errstatus = OCIEnvNlsCreate(&OCI_G(env), PHP_OCI_INIT_MODE, 0, NULL, NULL, NULL, 0, NULL, 0, 0);

        if (errstatus == OCI_ERROR) {
#ifdef HAVE_OCI_INSTANT_CLIENT
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that " PHP_OCI8_LIB_PATH_MSG " includes the directory with Oracl
e Instant Client libraries");
#else
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and " PHP_OCI8_LIB_PATH_MSG " are set and point
 to the right directories");
#endif
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 15:01:32 2024 UTC