PECL OCI8 1.4.4 is Available

PECL OCI8 1.4.4 has just been released. It fixes a potential memory corruption using oci_set_* functions seen on 64 bit machines. This release can be used to update OCI8 on earlier PHP versions.

During testing, command line PHP worked fine but in browser I immediately got the infamous error:

    Warning: oci_connect() [function.oci-connect]: OCIEnvNlsCreate()
    failed. There is something wrong with your system - please check
    that LD_LIBRARY_PATH includes the directory with Oracle Instant
    Client libraries in /home/cjones/public_html/ed.php on line 2

I thought I'd seen all causes of this error before. It means the web server doesn't have the Oracle environment set correctly. Commonly it happens on Windows machines with multiple versions of Oracle installed.

Since I had a reproducible test, I took the time to enhance OCI8 1.4.4 to display the underlying error message. Several people had been asking for this:

    Warning: oci_connect() [function.oci-connect]: OCIEnvNlsCreate()
    failed. There is something wrong with your system - please check
    that LD_LIBRARY_PATH includes the directory with Oracle Instant
    Client libraries in /home/cjones/public_html/ed.php on line 2

    Warning: oci_connect() [function.oci-connect]: Error while trying
    to retrieve text for error ORA-01804 in
    /home/cjones/public_html/ed.php on line 2 exiting

My web server environment was so screwed that Oracle couldn't even locate the message files to print ORA-01804: failure to initialize timezone information, which was the failing part of initialization. Sadly the new message wasn't much help in resolving my situation. I eventually tracked down the cause to httpd.conf having:

LoadModule php5_module        modules/libphp5.so
LoadModule php6_module        modules/libphp6.so

It's not valid to load multiple versions of PHP like this but Apache was starting without logging an error. My left-over PHP 6 library statically linked OCI8 and an ORACLE_HOME. My PHP 5 loaded OCI8 via extension=oci8.so and this was built with an Instant Client. The end result was an Oracle library clash.

The solution was to remove the LoadModule line for PHP6. You are unlikely to hit this exact problem, but it is a lesson in how the environment needs to be valid. Oracle messages can't always pinpoint set up issues. Care and methodical elimination of causes is needed to resolve similar problems.

Comments:

Post a Comment:
Comments are closed for this entry.
About

Tourists looking out over an Opal mine
I'm a Product Manager in Server Technologies, working on scripting languages and developer-access.
Email: christopher.jones@oracle.com
Twitter: http://twitter.com/ghrd
Links: OTN Node.js Developer Center
OTN PHP Developer Center
Book: Free PHP Oracle book

Follow:
Blaine Carter
Dan McGhan

Search

Archives
« September 2015
SunMonTueWedThuFriSat
  
1
2
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today