PHP Fatal error: Call to undefined function OCILogon()

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

syedferhat
Forum Newbie
Posts: 7
Joined: Sun Jan 13, 2008 11:01 pm
Location: Karachi
Contact:

PHP Fatal error: Call to undefined function OCILogon()

Post by syedferhat »

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

Code: Select all

<?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 6:52 am, edited 1 time in total.
Reason: Added [syntax=php||htm||css||javascript||sql||etc] - Please use [syntax] tags when posting code in the forums! Thanks.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: PHP Fatal error: Call to undefined function OCILogon()

Post by califdon »

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:

Code: Select all

include ('OCI.inc');
This may help: http://us2.php.net/include/
User avatar
emmbec
Forum Contributor
Posts: 112
Joined: Thu Sep 21, 2006 12:19 pm
Location: Queretaro, Mexico

Re: PHP Fatal error: Call to undefined function OCILogon()

Post by emmbec »

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
syedferhat
Forum Newbie
Posts: 7
Joined: Sun Jan 13, 2008 11:01 pm
Location: Karachi
Contact:

Re: PHP Fatal error: Call to undefined function OCILogon()

Post by syedferhat »

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:

Code: Select all

include ('OCI.inc');
This may help: http://us2.php.net/include/
syedferhat
Forum Newbie
Posts: 7
Joined: Sun Jan 13, 2008 11:01 pm
Location: Karachi
Contact:

Re: PHP Fatal error: Call to undefined function OCILogon()

Post by syedferhat »

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
User avatar
emmbec
Forum Contributor
Posts: 112
Joined: Thu Sep 21, 2006 12:19 pm
Location: Queretaro, Mexico

Re: PHP Fatal error: Call to undefined function OCILogon()

Post by emmbec »

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!
syedferhat
Forum Newbie
Posts: 7
Joined: Sun Jan 13, 2008 11:01 pm
Location: Karachi
Contact:

Re: PHP Fatal error: Call to undefined function OCILogon()

Post by syedferhat »

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!
devendra-m
Forum Contributor
Posts: 111
Joined: Wed Sep 12, 2007 3:16 am

Re: PHP Fatal error: Call to undefined function OCILogon()

Post by devendra-m »

uncomment it in php.ini file

;extension=php_oci8.dll
;extension=php_oracle.dll
devendra-m
Forum Contributor
Posts: 111
Joined: Wed Sep 12, 2007 3:16 am

Re: PHP Fatal error: Call to undefined function OCILogon()

Post by devendra-m »

Connect like following

Code: Select all

   $sid = "(DESCRIPTION =
                            (ADDRESS_LIST =
                            (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
                            )
                            (CONNECT_DATA =
                                (SERVICE_NAME = ora9i)
                            )
                       )";
 
        $conn = OCILogon('scott','tiger', $sid);
syedferhat
Forum Newbie
Posts: 7
Joined: Sun Jan 13, 2008 11:01 pm
Location: Karachi
Contact:

Re: PHP Fatal error: Call to undefined function OCILogon()

Post by syedferhat »

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

Code: Select all

<?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 6:52 am, edited 1 time in total.
Reason: Added [syntax=php||htm||css||javascript||sql||etc] - Please use [syntax] tags when posting code in the forums! Thanks.
devendra-m
Forum Contributor
Posts: 111
Joined: Wed Sep 12, 2007 3:16 am

Re: PHP Fatal error: Call to undefined function OCILogon()

Post by devendra-m »

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

Re: PHP Fatal error: Call to undefined function OCILogon()

Post by devendra-m »

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

it would be better like this

Code: Select all

; Directory in which the loadable extensions (modules) reside.
extension_dir = "c:/php/ext"
 
extension=php_oci8.dll
extension=php_oracle.dll
 
 
syedferhat
Forum Newbie
Posts: 7
Joined: Sun Jan 13, 2008 11:01 pm
Location: Karachi
Contact:

Re: PHP Fatal error: Call to undefined function OCILogon()

Post by syedferhat »

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

Code: Select all

<?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

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

extension=php_oci8.dll
extension=php_oracle.dll[/text]
devendra-m wrote:
extension=c:\php\ext\php_oci8.dll

it would be better like this

Code: Select all

; 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 6:52 am, edited 1 time in total.
Reason: Added [syntax=php||htm||css||javascript||sql||etc] - Please use [syntax] tags when posting code in the forums! Thanks.
User avatar
emmbec
Forum Contributor
Posts: 112
Joined: Thu Sep 21, 2006 12:19 pm
Location: Queretaro, Mexico

Re: PHP Fatal error: Call to undefined function OCILogon()

Post by emmbec »

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.
syedferhat
Forum Newbie
Posts: 7
Joined: Sun Jan 13, 2008 11:01 pm
Location: Karachi
Contact:

Re: PHP Fatal error: Call to undefined function OCILogon()

Post by syedferhat »

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.
Post Reply