Oracle Login problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Cesar
Forum Commoner
Posts: 31
Joined: Sat May 22, 2004 1:35 am

Oracle Login problem

Post by Cesar »

I like to connect to the oracle server, but i find this
Fatal error: Call to undefined function: ora_logon() in C:\Inetpub\wwwroot\test\test.php on line 2

Code: Select all

<?php
if ($c=ora_logon("SCOTT", "tiger")) {
  echo "Successfully connected to Oracle.\n";
  ora_logoff($c);
} else {
  $err = ora_error($c);
  echo "Oracle Connect Error " . $err;}

?>
Why? Please explain.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

user notes in PHP Manual (ora_logon()) wrote:Devon (12-Apr-2001 12:38)

In addition to above comments - I had a ORA-12545 error using ora_logon that I eventually found was simply a var/path problem - when you start up "apachectl start" make sure apache can find oracle!

keithv at bzlninc dot com (15-Mar-2000 12:10)

In order to get this to work properly I needed to have the ORACLE_HOME variable set before starting the Apache web server. I put it in the /etc/profile file, but you can do it anyway you choose.
Cesar
Forum Commoner
Posts: 31
Joined: Sat May 22, 2004 1:35 am

Post by Cesar »

i have php4 and IIS, not Apache.
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

The 'call to undefined function' error generally points to PHP not being compiled with that particular module (in this case oracle) or (where applicable) the extension has not been specified to be loaded in php.ini

As previously mentioned, you do need the ORACLE_HOME environment variable set correctly.
Cesar
Forum Commoner
Posts: 31
Joined: Sat May 22, 2004 1:35 am

Post by Cesar »

Previus error i corrected, but i have a new error:
Warning: ocilogon() [function.ocilogon]: _oci_open_server: ORA-12640: Authentication adapter initialization failed in
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

Personally I have very little knowledge of Oracle, however, quizzing a man who does suggests that you should locate and open the file... ORACLE_HOME\network\admin\sqlnet.ora

Then find the line..... sqlnet.authentication_services=(NTS)

And either remove it or replace it with.... sqlnet.authentication_services=(NONE)

I have no idea if this will work or indeed if there are any knock on implications but may be worth a try.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Cesar, your choice in topic titles needs work.. :)

I've switched it to something more useful.
hedge
Forum Contributor
Posts: 234
Joined: Fri Aug 30, 2002 10:19 am
Location: Calgary, AB, Canada

Post by hedge »

I have had issues with php being able to find the tnsnames.ora, to get around this I provide the entire section from the tnsnames as the connect string.
Cesar
Forum Commoner
Posts: 31
Joined: Sat May 22, 2004 1:35 am

Post by Cesar »

redmonkey thank you for your suggestion, but after changes sqlnet.authentication_services=(NTS) to sqlnet.authentication_services=(NONE) problem not corrected and i cant login to my database on dbastudio.

feyd why you mean "needs work".
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

topic titles should be descriptive. "php error" or whatever it was isn't helpful to us.
Ashabbir
Forum Newbie
Posts: 6
Joined: Mon Nov 01, 2004 2:47 pm
Location: UK

Oracle connecting

Post by Ashabbir »

Hye I'm quite new to the oracle connecting thing. I'm using Oracle 9i and want to connect to that through PHP. Does anyone know the syntax?
Need help, lol
Any help will appreciated
Post Reply