cant connect to oracle database server using oci_connect()
Posted by: sonumittal (59.94.245.---)
Date: May 26, 2008 07:26AM

hi
i m new at this forum. i am using wampserver 2c on xp sp2. i wanna connect my pc with oracle datadase server 8i using php. when i try to connect my oracle server using oci_connect(), it gives error "Fatal error: Call to undefined function oci_connect() in C:\wamp\www\New Folder\oracle.php on line 5".....
my oracle.php file is as give below

<html>
<title>sonu</title>
<body>
<?php
$c1 = oci_connect("scott", "tiger", SID_name);

function create_table($conn)
{
$stmt = oci_parse($conn, "create table scott.hallo (test varchar2(64))"winking smiley;
oci_execute($stmt);
echo $conn . " created table\n\n";
}

function insert_data($conn)
{
$stmt = oci_parse($conn, "insert into scott.hallo
values('$conn' || ' ' || to_char(sysdate,'DD-MON-YY HH24:MIconfused smileyS'))"winking smiley;
oci_execute($stmt, OCI_DEFAULT);
echo $conn . " inserted hallo\n\n";
}

function commit($conn)
{
oci_commit($conn);
echo $conn . " committed\n\n";
}

function select_data($conn)
{
$stmt = oci_parse($conn, "select * from scott.hallo"winking smiley;
oci_execute($stmt, OCI_DEFAULT);
echo $conn."----selecting\n\n";
while (oci_fetch($stmt)) {
echo $conn . " [" . oci_result($stmt, "TEST"winking smiley . "]\n\n";
}
echo $conn . "----done\n\n";
}

create_table($c1);
insert_data($c1); // Insert a row using c1
select_data($c1); // Results of both inserts are returned
commit($c1);
?>
</body>
</html>

i have taken many steps to remove this.......
i have removed ";" from the start of the lines extension=php_oci.dll
=php_oracle.dll
in the both php.ini file (one in php/php 5.2.6 and 2nd in apache/bin folder) to make these extension loaded at the startup....
i have make the extension_dir 's path to point to the my ext dir where all dll resides
i.e. extension_dir = "c:/wamp/bin/php/php5.2.6/ext/"
now my phpinfo shows oracle heading under the main heading of php credits...
it shows
"oracle
Oracle Supportenabled Extension Version 0.1.0-dev "
but when i try to make connection using oci_connect(), it gives the same error........
tell me wat to do ........
i m frustrated ..........
tell me a solution......

Options: ReplyQuote
Re: cant connect to oracle database server using oci_connect()
Posted by: sonumittal (59.94.245.---)
Date: May 26, 2008 09:06AM

is there nobody to help me..........
its urgent man..........
plz help me.........

no expert here??????

all admin help needeed...........

all experts are welcome......

Options: ReplyQuote
Re: cant connect to oracle database server using oci_connect()
Posted by: yfastud (Moderator)
Date: May 27, 2008 03:20AM

I've helped somebody here before to resolve this problem, and you need to download php_oci8.dll here:

[pecl4win.php.net]

And save in php dll folder, and of course edit that line to become

extension=php_oci8.dll

Save file and restart wamp to take effect

BTW, this worked for oracle9i, but not sure about latest oracle, so if it's not working for you, then you need to to find out the correct dll file. Good luck buddy ;-)

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: cant connect to oracle database server using oci_connect()
Posted by: sonumittal (59.94.251.---)
Date: May 27, 2008 05:39AM

thanks for your reply........
but buddy, i have done all that...........

Options: ReplyQuote
Re: cant connect to oracle database server using oci_connect()
Posted by: yfastud (Moderator)
Date: May 27, 2008 03:08PM

So you've actually downloaded and replaced old oci w/ oci8?

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: cant connect to oracle database server using oci_connect()
Posted by: sonumittal (59.94.237.---)
Date: May 28, 2008 09:05AM

ya i have done that........
but tell me one thing........
when i have downlaoded the latest wampserver2c even after that i have to download the oci8 and ociw file ......
why.......

Options: ReplyQuote
Re: cant connect to oracle database server using oci_connect()
Posted by: yfastud (Moderator)
Date: May 28, 2008 03:13PM

As mentioned, I don't use oracle no more, so not quite sure about that, but you might have to find dll to work w/ later oracle :-(

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote


Sorry, only registered users may post in this forum.