This content has been marked as final.
Show 18 replies
-
1. Re: OCIEnvNlsCreate() failed
567433 Mar 19, 2007 8:33 PM (in response to user564695)After another day of unsuccessful experiments I still couldn't make my remote connection work.
But I found out, after I switched from the MDB2 functions to PHP's standard OCI functions, that I've got the same problem with the "PATH Error" as you describe it here but I only didn't see it before because MDB2's error message was not that clear.
One very interesting thing is that I can connect to the remote server with my client's "10 XE Client (installer version)" from the SQL command line without any problems.
Did you have any success today ? :-)
*** Michl -
2. Re: OCIEnvNlsCreate() failed
user564695 Mar 20, 2007 7:54 AM (in response to 567433)I can connect with sql*plus but not in php
I do not know how to make to succeed
thanks
Jean-Philippe -
3. Re: OCIEnvNlsCreate() failed
567433 Mar 20, 2007 10:55 AM (in response to user564695)Hi Jean-Philippe,
I finally solved the problem on my machine !
I did some side-by-side comparisons between the phpInfo() output of my well working server's XAMPP environment(v. 1.5.1)
and the output of the remote client's environment (v. 1.6.0a).
The result is that the "php_oci8.dll" bundled with the earlier XAMPP version on my server has a higher version number ("1.28***")
(although it's definetly older as the file timestamp shows) than the (newer) one included with later XAMPP distribution ("1.26**") on my client.
My first attempt to fix it was to replace the client's 1.26 with the server's 1.28 but this didn't work because it disabled
PHP's OCI8 support after a Apache restart.
The next try was the successful one but I had to switch back to PHP 5.1.1 (that's not really a big thing for me).
1. Uninstall the client's current XAMPP environment (1.6.0a) completly using the uninstaller.
2. Install XAMPP (1.5.1).
3. Check that the "Instand Client Basic" is installed in a folder and the path to that folder is included at the beginning of
your global "Path" environment variable.
(e.g.: D:\oracleclient;%SystemRoot%\system32;...)
I also removed all other environment variables I created during my previous tests and experiments like "ORACLE_HOME", ...
because they're not neccesary.
4. Uncomment the "php_oci8.dll" inside the "php.ini".
5. Restart the Apache.
6. Check phpInfo() for OCI8 support enabled.
7. Check that you use the correct DSN or Database syntax in your PHP script.
Standard PHP OCI functions:
oci_connect("user", "password", "//130.50.15.224/xe")
MDB2 DSN:
oci8://user:password@/130.50.15.224/xe
8. Your remote database connection should work now.
*** Michl -
4. Re: OCIEnvNlsCreate() failed
user564695 Mar 29, 2007 10:06 AM (in response to user564695)allways the problem
I have installed xamp like you have said
and now I have this message:
Warning: oci_connect() [function.oci-connect]: OCIEnvInit() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory in C:\Program Files\xampp\htdocs\xampp\essai_ora_v1.php on line 13
when i use regedit only one variable ORACLE_HOME : c:\instant_client_10_2 !!!
this is my file essai_ora_v1.php:
<?php
print(date("1 F d, Y"));
$db = "(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = XXX.XXX.XXX.XXX) (PORT = 1521)))(CONNECT_DATA =(SID = YYY)))";
$db = oci_connect("user","password",$db);
?>
I am disappointed, I think that there are no solutions!!!!
Jean-Philippe -
5. Re: OCIEnvNlsCreate() failed
562647 Mar 30, 2007 2:54 PM (in response to user564695)Goodmorning,
You shouldn't need ORACLE_HOME with instant client.
Instead of:
<?php
print(date("1 F d, Y"));
$db = "(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = XXX.XXX.XXX.XXX) (PORT = 1521)))(CONNECT_DATA =(SID = YYY)))";
$db = oci_connect("user","password",$db);
?>
Try:
<?php
print(date("1 F d, Y"));
$c=OCILogon("user", "password", "XXX.XXX.XXX.XXX:1521/YYY");
?>
Hope this helps -
6. Re: OCIEnvNlsCreate() failed
cj Apr 3, 2007 8:54 PM (in response to 562647)As the previous poster pointed out you don't need ORACLE_HOME set when you are using Instant Client. Also LD_LIBRARY_PATH is a UNIX variable.
Unset both of these. Also try unsetting NLS_LANG and let it default for the moment.
Are you sure there is no other Oracle software on the machine or values in the registry?
-- cj -
7. Re: OCIEnvNlsCreate() failed
490742 May 23, 2007 6:04 PM (in response to user564695)I've met absolutely the same problem.
And it was solved here: http://www.thescripts.com/forum/thread637481.html
The thing is - you simply must change permissions for some oracle files by script: $ORACLE_HOME/install/changePerm.sh
After I made so - no problems.
Sergey -
8. Re: OCIEnvNlsCreate() failed
617157 Jan 11, 2008 10:08 AM (in response to 490742)Hi everybody,
Sorry for asking how i can make this changing in permission under windows??
where i could run this script??
thanks for your help, -
9. Re: OCIEnvNlsCreate() failed
552054 May 13, 2008 2:18 PM (in response to 617157)Hey everybody. I also wunder how to change the permissions under windows. I hope yu kan help me
Message was edited by:
user549051 -
10. Re: OCIEnvNlsCreate() failed
cj May 13, 2008 6:28 PM (in response to 552054)I've not heard that Windows has the same permission issue?
If you have a similar error, start a new thread.
-- cj -
11. Re: OCIEnvNlsCreate() failed
491831 Jun 10, 2008 8:00 AM (in response to cj)I don't think this problem has anything to do with file permissions, but is actually exactly as the error message suggests : that environment variables are not set as far as PHP/Apache is concerned. I've had this same problem but have finally found a solution.
First, check if the env-variables ORACLE_HOME and NLS_LANG are actually being picked up by PHP. I had set and exported them before starting Apache (using sudo) but using phpinfo() the "PHP Variables" section (near the end) didn't show either of these variables as being set, just as the error message suggested.
The solution was to include both ORACLE_HOME and NLS_LANG variables in the "envvars" file which is located in the same directory as apachectl (the script you use to start the apache daemon).
Add the two entries exactly as you would as if they were in a .profile
eg:
export ORACLE_HOME=/Volumes/u01/app/oracle/product/10.1.0/db_4
export NLS_LANG=.AL32UTF8
Save the file, and restart apache.
Using phpinfo() you should now see both variables listed in the "PHP Variables" section.
PHP should now be able to connect to Oracle -
12. Re: OCIEnvNlsCreate() failed
CaptainPackers Apr 22, 2009 6:05 PM (in response to 491831)I was beating my head against the wall trying to figure this out. Adding the exports to envvars detailed by user488828 was the ticket.
Thanks. You're the man (or woman)!
Don
Ypsilanti, MI -
13. Re: OCIEnvNlsCreate() failed
cj Apr 23, 2009 6:19 PM (in response to CaptainPackers)Where they need to be set is OS and version specific. There's a section on "Setting Oracle Environment Variables for Apache" in http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf which has some general guidelines. -
14. Re: OCIEnvNlsCreate() failed
703855 May 9, 2010 7:36 AM (in response to 490742)That or, edit /etc/group and simply add www-data (apache user) to oinstall group.