after much pain also attempting to use XAMPP on WinXP and connect to Oracle using the InstantClient with PHP, ... i got it to work (did i mention with great pain?)!
Initial details:
- my linux box is busy with something else so i am currently forced to use winxp on an ibm, uh, lenovo T400.
- download the latest xampp release:
http://www.apachefriends.org/en/xampp-windows.html- download the latest oracle instant client (requires a login):
http://www.oracle.com/technology/software/tech/oci/instantclient/index.html- modify
C:\xampp\php\php.ini and uncomment/activate the following lines:
extension=php_oracle.dll
extension=php_oci8.dll
- PLEASE NOTE: NO other oracle product is installed on this winxp box- This also means I have NO tnsnames.ora file, etc.hi-level steps:- simply extracted xampp onto c: drive, i.e. c:\xampp\...
- created a php html page: C:\xampp\htdocs\index.php with the following content:
<?php
$db_test = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.10.10)(PORT=1521)) (CONNECT_DATA=(SID=TEST)))';
$c = oci_connect("user", "passwd", $db_test);
$s = oci_parse($c, 'select * from some_table order by some_column');
oci_execute($s);
while ($res = oci_fetch_array($s, OCI_ASSOC)) {
var_dump($res);
}
?>
- attempted to add the instantclient dlls to the windoze PATH and created LD_LIBRARY_PATH, etc. and various place on the box.
So the failed result(s) with the url
http://localhost/index.php ...
the following error message would appear:
oci_connect() http://function.oci-connect: OCIEnvNlsCreate() failed.after searching and reviewing everywhere and basically trying everything (btw, not much help with xampp on winxp for this error, figures...
), this oracle forum thread provided the best hint for the apparent
lame fix:
http://forums.oracle.com/forums/thread.jspa?threadID=762528&tstart=0In summary:Starting completely OVER (yeah, i got frustrated enough and want a clean start)...Final details, in reasonable order:
- using winxp sp2
- download the latest xampp release:
http://www.apachefriends.org/en/xampp-windows.html- extracted xampp onto c: drive, i.e. c:\xampp\...
- modify
C:\xampp\php\php.ini and uncomment/activate the following lines:
extension=php_oracle.dll
extension=php_oci8.dll
- (again)PLEASE NOTE: NO other oracle product is installed on this winxp box (oracle clients, etc.)
- (again)This also means I have NO [i]tnsnames.ora file, etc.
- (lame)Do not bother updating the windoze env PATH (has no effect).
- (lame)Do not both updating the windoze env LD_LIBRARY_PATH either (no effect anyhow).[/i]- download the latest oracle instant client (requires a login):
http://www.oracle.com/technology/software/tech/oci/instantclient/index.html- extracted the oracle instantclient to
C:\Temp\instantclient-basic-win32-11.1.0.7.0\- copy the contents only from
C:\Temp\instantclient-basic-win32-11.1.0.7.0\instantclient_11_1\* over
to
C:\xampp\apache\bin- start xampp up:
c:\xampp\apache_start.bat- create a php html page to log into oracle called
C:\xampp\htdocs\index.php with the previously mentioned php code snippet above:
<?php
$db_test = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.10.10)(PORT=1521)) (CONNECT_DATA=(SID=TEST)))';
$c = oci_connect("user", "passwd", $db_test);
$s = oci_parse($c, 'select * from some_table order by some_column');
oci_execute($s);
while ($res = oci_fetch_array($s, OCI_ASSOC)) {
var_dump($res);
}
?>- CHECK IT! (drum roll please) browse on over to
http://localhost/index.phpvoila! with much irritation... JOY! IT WORKS (for me at least)! basically, i was attempting to create an alternative test bed for a reporting project-o-mine using php to connect to oracle for bedazzling reports, etc. hopefully this help someone out there...
-p