PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Jun 19, 2018 8:59 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Mon Jan 14, 2008 12:40 am 
Offline
Forum Newbie

Joined: Mon Jan 14, 2008 12:01 am
Posts: 7
Location: Karachi
Hi Friends

I am new with PHP I would like to connect my PHP page with Oracle 9i Database and for that i am using following codes. I am Using PHP Version 5.2.5 with IIS version 5.1 and internet Explorer version 6.

When I run my PHP page I got error PHP Fatal error: Call to undefined function OCILogon().
I had search a lot of thing but still fail to resolve this error. Please help me what i need to do...

PHP Code
Syntax: [ Download ] [ Hide ]
<?php
$conn = OCILogon("scott","tiger", "ferhat");
$stmt = OCIParse($conn,"select * from emp where empno > :emp order by empno");
$emp = 7900;
OCIBindByName($stmt, ':emp', $emp);
$ok = OCIExecute($stmt);
while (OCIFetchInto($stmt,$arr)) {
        print_r($arr);
        echo "<hr>";   
}


?>


Last edited by Benjamin on Fri Nov 18, 2011 7:52 am, edited 1 time in total.
Added [syntax=php||htm||css||javascript||sql||etc] - Please use [syntax] tags when posting code in the forums! Thanks.


Top
 Profile  
 
PostPosted: Mon Jan 14, 2008 1:16 am 
Offline
Jack of Zircons
User avatar

Joined: Thu Nov 09, 2006 9:30 pm
Posts: 4484
Location: California, USA
Welcome to DevNetwork. The error message is telling you that it was unable to find the function named OCILogon() that you called. Ordinarily, that would be probably be in an "include file", a separate file that must be on your server and that you must reference in this script with something like this:

Syntax: [ Download ] [ Hide ]
include ('OCI.inc');


This may help: http://us2.php.net/include/


Top
 Profile  
 
PostPosted: Mon Jan 14, 2008 6:07 pm 
Offline
Forum Contributor
User avatar

Joined: Thu Sep 21, 2006 12:19 pm
Posts: 112
Location: Queretaro, Mexico
What OS do you have PHP installed on?

If it is on Windows you need to add some DLL's to the apache/bin folder.

Also check in your PHPINFO that you have the following section:

oci8
OCI8 Support enabled


Top
 Profile  
 
PostPosted: Tue Jan 15, 2008 6:02 am 
Offline
Forum Newbie

Joined: Mon Jan 14, 2008 12:01 am
Posts: 7
Location: Karachi
Dear Friend

Thanks for your prompt reply but the thing is that where do i get 'OCI.INC' file i had searched the same on my computer and not able to find. Also let me know where do i copy the same file if i download the same form somewhere.



califdon wrote:
Welcome to DevNetwork. The error message is telling you that it was unable to find the function named OCILogon() that you called. Ordinarily, that would be probably be in an "include file", a separate file that must be on your server and that you must reference in this script with something like this:

Syntax: [ Download ] [ Hide ]
include ('OCI.inc');


This may help: http://us2.php.net/include/


Top
 Profile  
 
PostPosted: Tue Jan 15, 2008 6:06 am 
Offline
Forum Newbie

Joined: Mon Jan 14, 2008 12:01 am
Posts: 7
Location: Karachi
Dear Friend

I am using Windows XP with IIS 5.1. Can you tell me what i need to do to enabled oci 8 Support. Also let me know which DLL's are required as i am using IIS instead of Apache

emmbec wrote:
What OS do you have PHP installed on?

If it is on Windows you need to add some DLL's to the apache/bin folder.

Also check in your PHPINFO that you have the following section:

oci8
OCI8 Support enabled


Top
 Profile  
 
PostPosted: Tue Jan 15, 2008 10:20 am 
Offline
Forum Contributor
User avatar

Joined: Thu Sep 21, 2006 12:19 pm
Posts: 112
Location: Queretaro, Mexico
You need the oracle DLL's that are found in your oracle installation. You need to enable OCI8 support in your php.ini file.

To see how to configure Oracle with IIS take a look at the following page:

http://download.oracle.com/docs/cd/A973 ... config.htm

Hope it helps!


Top
 Profile  
 
PostPosted: Wed Jan 16, 2008 4:34 am 
Offline
Forum Newbie

Joined: Mon Jan 14, 2008 12:01 am
Posts: 7
Location: Karachi
Dear Friend

I had tried to search oraiisp8.dll file on my computer / where IIS running but unabled to find the above said file on both Client folder C:\ORAXP\BIN also on my oracle home folder (Server) "O:\ORANT\BIN".

Kindly let me know from where do i download or installed that file on my computer

Thanks


emmbec wrote:
You need the oracle DLL's that are found in your oracle installation. You need to enable OCI8 support in your php.ini file.

To see how to configure Oracle with IIS take a look at the following page:

http://download.oracle.com/docs/cd/A973 ... config.htm

Hope it helps!


Top
 Profile  
 
PostPosted: Wed Jan 16, 2008 5:13 am 
Offline
Forum Contributor

Joined: Wed Sep 12, 2007 3:16 am
Posts: 111
uncomment it in php.ini file

;extension=php_oci8.dll
;extension=php_oracle.dll


Top
 Profile  
 
PostPosted: Wed Jan 16, 2008 5:22 am 
Offline
Forum Contributor

Joined: Wed Sep 12, 2007 3:16 am
Posts: 111
Connect like following

Syntax: [ Download ] [ Hide ]
   $sid = "(DESCRIPTION =
                            (ADDRESS_LIST =
                            (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
                            )
                            (CONNECT_DATA =
                                (SERVICE_NAME = ora9i)
                            )
                       )"
;
 
        $conn = OCILogon('scott','tiger', $sid);


Top
 Profile  
 
PostPosted: Thu Jan 17, 2008 5:02 am 
Offline
Forum Newbie

Joined: Mon Jan 14, 2008 12:01 am
Posts: 7
Location: Karachi
Dear Friend

I had enabled by uncommenting both line in my php.ini file. following are those line of my php.ini. as my php files on the same location

extension=c:\php\ext\php_oci8.dll
extension=c:\php\ext\php_oracle.dll

Also i tried to make connection by using following codes as you advise me but still getting the same error Call to undefined function OCILogon() . here is my codes

Syntax: [ Download ] [ Hide ]
<?php
echo phpinfo();
 $sid = "(DESCRIPTION =
                            (ADDRESS_LIST =
                            (ADDRESS = (PROTOCOL = TCP)(HOST = ferhatnaqvi)(PORT = 1521))
                            )
                            (CONNECT_DATA =
                                (SERVICE_NAME = ferhat.world)
                            )
                       )"
;
 
$conn = OCILogon('scott','tiger', $sid);


Kindly advise me where i do make mistake


devendra-m wrote:
uncomment it in php.ini file

;extension=php_oci8.dll
;extension=php_oracle.dll


Last edited by Benjamin on Fri Nov 18, 2011 7:52 am, edited 1 time in total.
Added [syntax=php||htm||css||javascript||sql||etc] - Please use [syntax] tags when posting code in the forums! Thanks.


Top
 Profile  
 
PostPosted: Thu Jan 17, 2008 5:08 am 
Offline
Forum Contributor

Joined: Wed Sep 12, 2007 3:16 am
Posts: 111
provide (HOST = IP address) of the database server or (HOST=localhost) if it is in the same server


Top
 Profile  
 
PostPosted: Thu Jan 17, 2008 5:14 am 
Offline
Forum Contributor

Joined: Wed Sep 12, 2007 3:16 am
Posts: 111
Quote:
extension=c:\php\ext\php_oci8.dll



it would be better like this
Syntax: [ Download ] [ Hide ]
; Directory in which the loadable extensions (modules) reside.
extension_dir = "c:/php/ext"
 
extension=php_oci8.dll
extension=php_oracle.dll
 
 


Top
 Profile  
 
PostPosted: Fri Jan 18, 2008 6:13 am 
Offline
Forum Newbie

Joined: Mon Jan 14, 2008 12:01 am
Posts: 7
Location: Karachi
Dear Friend

Well i had do the same as you advised me in your both messages. But still having same error.
I would like to know that you advise me to use extension_dir = "c:/php/ext" instead of extension_dir = "c:\php\ext". Plz help me....

Following are the codes and php.ini settings for your consideration

PHP Codes

Syntax: [ Download ] [ Hide ]
<?php
//echo phpinfo();
 $sid = "(DESCRIPTION =
                            (ADDRESS_LIST =
                            (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.0.121)(PORT = 1521))
                            )
                            (CONNECT_DATA =
                                (SERVICE_NAME = ferhat.world)
                            )
                       )"
;
 

$conn = OCILogon('scott','tiger', $sid);
?>


PHP.INI Settings

Syntax: [ Download ] [ Hide ]
; Directory in which the loadable extensions (modules) reside.
extension_dir = "c:/php/ext"

extension=php_oci8.dll
extension=php_oracle.dll


devendra-m wrote:
Quote:
extension=c:\php\ext\php_oci8.dll



it would be better like this
Syntax: [ Download ] [ Hide ]
; Directory in which the loadable extensions (modules) reside.
extension_dir = "c:/php/ext"
 
extension=php_oci8.dll
extension=php_oracle.dll
 
 


Last edited by Benjamin on Fri Nov 18, 2011 7:52 am, edited 1 time in total.
Added [syntax=php||htm||css||javascript||sql||etc] - Please use [syntax] tags when posting code in the forums! Thanks.


Top
 Profile  
 
PostPosted: Fri Jan 18, 2008 9:53 am 
Offline
Forum Contributor
User avatar

Joined: Thu Sep 21, 2006 12:19 pm
Posts: 112
Location: Queretaro, Mexico
If you don't have the DLL's you are never going to get oracle working. Find those DLLs and put them in your extension folder. I usually find them where I installed oracle.


Top
 Profile  
 
PostPosted: Mon Jan 21, 2008 5:50 am 
Offline
Forum Newbie

Joined: Mon Jan 14, 2008 12:01 am
Posts: 7
Location: Karachi
if you talk about oraiisp8.dll then i could not find the same file on my machine. If you suggest that i again installed oracle client on my machine the plz let me know in customize installation which option i want to use to get the same file.

And if you talk about php_oci8.dll and php_oracle.dll the i would like to inform you that i already copied both file in php\ext dirctory and also i already mention/ enabled the same in

Thanks

emmbec wrote:
If you don't have the DLL's you are never going to get oracle working. Find those DLLs and put them in your extension folder. I usually find them where I installed oracle.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group