Page 1 of 2

PHP Fatal error: Call to undefined function OCILogon()

Posted: Sun Jan 13, 2008 11:40 pm
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>";	
} 


?>

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

Posted: Mon Jan 14, 2008 12:16 am
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/

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

Posted: Mon Jan 14, 2008 5:07 pm
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

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

Posted: Tue Jan 15, 2008 5:02 am
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/

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

Posted: Tue Jan 15, 2008 5:06 am
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

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

Posted: Tue Jan 15, 2008 9:20 am
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!

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

Posted: Wed Jan 16, 2008 3:34 am
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!

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

Posted: Wed Jan 16, 2008 4:13 am
by devendra-m
uncomment it in php.ini file

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

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

Posted: Wed Jan 16, 2008 4:22 am
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);

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

Posted: Thu Jan 17, 2008 4:02 am
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

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

Posted: Thu Jan 17, 2008 4:08 am
by devendra-m
provide (HOST = IP address) of the database server or (HOST=localhost) if it is in the same server

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

Posted: Thu Jan 17, 2008 4:14 am
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
 
 

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

Posted: Fri Jan 18, 2008 5:13 am
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
 
 

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

Posted: Fri Jan 18, 2008 8:53 am
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.

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

Posted: Mon Jan 21, 2008 4:50 am
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.