3

We've been using Oracle on our server for years, but someone from IT removed it yesterday without clear warning and it's really thrown our systems!

I've acted on the advice from cwallenpoole (thank you!) and have made good progress, and PHP is now at least including the oracle functions (ie oci_connect) but I am now experiencing another error message:

"Warning: oci_connect() [function.oci-connect]: ORA-12705: Cannot access NLS data files or invalid environment"

We have ensured the tnsnames.ora etc files are in the correct place, but still having no joy :(

thank you

Nick
  • 3,745
  • 20
  • 56
  • 75
  • 1
    Have you restarted the web server? Are you 100% sure you're editing the right php.ini as mentioned when calling `phpinfo()`? – Pekka Jul 01 '11 at 14:25
  • Thank you for the reply - yes we've restarted the server (many, many times unfortunately!) and we're definitely editing the right PHP.ini file after checking through phpinfo and also echo php_ini_loaded_file(); One thing though - we have 4 web setups that all had their own php.ini, but they all share the same one now :( – Nick Jul 01 '11 at 14:27
  • 1
    Does `phpinfo()` make any mention of OCI? – Pekka Jul 01 '11 at 14:29
  • Nope, only a few paths that we have set to be included. On our old server we have a full section for 'oci8' (using Zend Core for Oracle btw, which we don't have now, so it'd be tricky to use the same settings) – Nick Jul 01 '11 at 14:31
  • 1
    Hmm, then the extension isn't getting loaded. Which *should* mean that it's not reading the `extension=php_oci8_dll` line, otherwise it would crash on restart. But you say you've checked the paths, and it's the correct php.ini... Weird! – Pekka Jul 01 '11 at 14:34
  • My thoughts too! Anyway to check exactly if it's trying to read that extension file? Or what the hell it's trying to do?! :) – Nick Jul 01 '11 at 14:37
  • 1
    from my experience, it either manages to successfully read the extension file, or it crashes. There is no grey area there. What you could try to do is deliberately change the file name to something incorrect. If that goes through without complaint, it's not reading the INI file for whatever reason – Pekka Jul 01 '11 at 14:38
  • @Pekka let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/1056/discussion-between-nick-and-pekka) – Nick Jul 01 '11 at 14:51
  • 1
    http://forums.oracle.com/forums/thread.jspa?threadID=406036 – dqhendricks Jul 04 '11 at 07:53
  • Does this answer your question? [ORA-12705: Cannot access NLS data files or invalid environment](https://stackoverflow.com/questions/7700330/ora-12705-cannot-access-nls-data-files-or-invalid-environment) – Vega Jun 25 '20 at 11:23

1 Answers1

3

Ok. This is my personal nightmare. I seriously wake up in the middle of the night... or I don't, but I have spent days on this problem.

So, this is what worked for me:

  1. Do you have Oracle Instant Client? If not get it.
  2. Do you have the Oracle SDK? If not get it.
  3. Unzip instantclient.
  4. Unzip the SDK into a sub-directory
  5. Add ORACLE_HOME as an exported command line variable ($ORACLE_HOME in *nix, %ORACLE_HOME% in win). Have it point to the fully-qualified path to the above instantclient folder.
  6. Create ORACLE_BIN and have it point to the SDK.
  7. Add ORACLE_HOME to your PATH.
  8. Restart Apache...

So... that is what I generally do... And generally it works... Mostly...

I think that realistically all I can say is Good Luck and Godspeed.

cwallenpoole
  • 79,954
  • 26
  • 128
  • 166
  • Huge thanks for this! It's now loading the PHP files but says: Warning: oci_connect() [function.oci-connect]: ORA-12705: Cannot access NLS data files or invalid environment – Nick Jul 04 '11 at 10:32
  • 1
    :::sigh::: Well, at that point, I just downloaded everything in at the Oracle Instant Client SDK site and put it all into one sub-directory. If that doesn't work, let me know and tomorrow I'll look into the TNSADMIN stuff. – cwallenpoole Jul 04 '11 at 12:50
  • Thank you, but which is the Instant Client SDK download? http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html In the end I used the JRE from here, but it's probably wrong: http://www.oracle.com/technetwork/java/javase/downloads/index.html Thanks again! – Nick Jul 04 '11 at 13:22
  • 1
    Instantclient is here: http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html You'll need to figure out which one on your own though -- it's hardware architecture specific. – cwallenpoole Jul 04 '11 at 13:25
  • Thank you! Lots of faffing around and ifnally got it working - lots of playing with the registry, the environmental variables paths, the tns_admin, oracle_home and all manner of other things, wooooo! thanks again :) – Nick Jul 04 '11 at 14:19