Re: PHP 5.0.3 and Oracle9i on Windows 2000/Apache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I used Oracle only a few times, and what I did is a apache start script where I specify the option:


#!/bin/sh


ORACLE_BASE=/oracle/base ORACLE_HOME=/oracle/home ORACLE_TERM=vt100 TNS_ADMIN=${ORACLE_HOME}/admin/ ORACLE_PATH=${ORACLE_HOME}/bin ORA_NLS32=${ORACLE_HOME}/data NLS_LANG=American_america.UTF8



export ORACLE_HOME=/oracle/home
export ORACLE_SID=ORACLE_SID
echo "ORACLE_BASE: $ORACLE_BASE"
echo "ORACLE_TERM: $ORACLE_TERM"
echo "TNS_ADMIN: $TNS_ADMIN"
echo "ORACLE_PATH: $ORACLE_PATH"
echo "ORA_NLS32: $ORA_NLS32"
echo "NLS_LANG: $NLS_LANG"
echo "Oracle Home: $ORACLE_HOME"
echo "Oracle SID:  $ORACLE_SID"
echo Starting Apache
then start apache with your options


I don't really know if this may help you, as I said I'm not very familiar with that, it just worked for me...


Chaun Keating wrote:

I agree with your theory of the possibility that the cli version of php is
using a different ini file than the
apache2 module/cgi.  I have no clue as to how to confirm that or to correct
it though, and advice there?

I do restart Apache anytime I make config changes, hasn't seemed to have
helped at all.

The putenv seems to work just dandy as the script worked fine from the
command line either wheather the putenv(s) were commented out or not.

Thanks,
Chaun

-----Original Message-----
From: Jochem Maas [mailto:jochem@xxxxxxxxxxxxx]
Sent: Monday, January 17, 2005 10:48 AM
To: Chaun Keating
Cc: php-db@xxxxxxxxxxxxx
Subject: Re:  PHP 5.0.3 and Oracle9i on Windows 2000/Apache


Chaun Keating wrote:


I am having trouble logging onto Oracle via PHP on a Windows 2000 machine.

I keep getting the error:

Fatal error: Call to undefined function OCILogon() in C:\Program
Files\Apache Group\Apache2\htdocs\oraconnect.php on line 15

I seem to have everything set up correctly. I am running an Oracle 9i
client and have set up the php.ini file with "extension=php_oci8.dll"
uncommented, left ";extension=php_oracle.dll" commented. (Although I have
tried various combinations of these two. Also I have set the


"extension_dir


= C:\Program Files\PHP\ext" correctly and noted that php_oci8.dll and
php_oracle.dll exist there.

Now here is where it gets really weird and I could use some help:

It works fine from the command line:



possibly the cli version of php is using a different ini file than the apache2 module/cgi. also you made need to restart apache in order to reread the php.ini file.

with regard to putenv() - you may be suffering from safe_mode being on.

also, (I don't know this!), if putenv is setting env vars whose scope is
server-process wide then concurrent scripts _maybe_ messing each other
up: e.g.  request1 starts and does some putenv()s, request2 does the
same a fraction later, request1 finishes and resets stuff done by
putenv(), request2 trys to connect...which fails because the env vars
are empty.



I type "php oraconnect.php" for the following code:
<?php
//putenv("ORACLE_SID=TESTDB");
//putenv("ORACLE_HOME=C:/oracle/ora92");
//putenv("TNS_ADMIN=C:/oracle/ora92/network/admin");
$username = "SCOTT";
$passwd = "TIGER";
//$db="(DESCRIPTION=
//          (ADDRESS_LIST=
 //           (ADDRESS=(PROTOCOL=TCP)
  //            (HOST=orahostname1)(PORT=1621)
   //         )
    //      )
 //           (CONNECT_DATA=(SERVICE_NAME=TESTDB))
  //  )";
$conn = OCILogon("SCOTT","TIGER","TESTDB");
if (!$conn)
{
  echo "Connection failed";
  echo "Error Message: [" . OCIError($conn) . "]";
  exit;
}
else
{
  echo "Connected!";
}
?>


It works either way with the env_variables in the script or with them commented out from the command line. I just can't get it to work from the browser.

Can anyone out there help me with this one?  I have some experience with
Oracle, Perl, and a little Java but not so much with PHP.

Thanks.







-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux