Jump to content

Can't start a connection between PHP and Oracle database


Recommended Posts

Hey all, hope u all doing well  ;D

I'm new to PHP and Oracle database ....

and I'm building a website that should be connected to Oracle database

but the problem is , I can't start the basic connection  :'(  :-\

 

I installed AppServ 2.6 with PHP6 and I copy the php_oci8.dll file to the PHP6 file, but I read that php_oracle.dll should be also copied, so I download it from the internet and added it to php6 folder

after that I opened php.ini and remove the comment for both libraries

extension=php_oci8.dll

extension=php_oracle.dll

 

And I edited this line

extension_dir = "C:\AppServ\php6"

 

but I keep having this error:

Fatal error: Call to undefined function oci_logon() in C:\AppServ\www\test.php

 

 

The code:

<?php

//File: dbtime.php

$dbHost = "localhost";

$dbHostPort="1521";

$dbServiceName = "orcl";

$usr = "USER";

$pswd = "PASS";

$dbConnStr = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)

 

(HOST=".$dbHost.")(PORT=".$dbHostPort."))

(CONNECT_DATA=(SERVICE_NAME=".$dbServiceName.")))";

if(!$dbConn = oci_logon($usr,$pswd,$dbConnStr))

$err = oci_error();

 

 

$strSQL = "SELECT TO_CHAR(SYSDATE, ‘HH:MI:SS') ctime FROM DUAL";

$stmt = oci_parse($dbConn,$strSQL);

if (!oci_execute($stmt)) {

$err = oci_error($stmt);

 

};

oci_fetch($stmt);

//$rslt = oci_result($stmt,‘CTIME');

echo "<h3>The current time is $rslt </h3>";

?>

 

 

I'm so desperate now  :'(  ??? , I spent the last three hours searching for a solution but I didn't find

Please any suggestions ?!?!?

 

Noor

 

 

 

Link to comment
Share on other sites

Hey Folk ...

I wonder why no body answered me, even some ppl read the post ....

anyway....

I find the solution for my problem and I though to get back here and post the answer  ;D

 

check this link

http://me2learn.wordpress.com/2008/10/18/connect-php-with-oracle-database/

 

I want to change this post to be green and solved, I'm new here and I think i dunno how ....

so it's SOLVED  ;D

 

Regards,

Noor

;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.