Connection to Oracle database via php

Connection to Oracle database via php

by John Reese -
Number of replies: 6

so i tried to test the connection using this simple php page

<?php
// Create connection to Oracle
$conn = oci_connect("phphol", "welcome", "192.xxx.xxx.xxx:1521/test");
if (!$conn) {
$m = oci_error();
echo $m['message'], "\n";
exit;
}
else {
print "Connected to Oracle!";
}
// Close the Oracle connection
oci_close($conn);
?>

Where our enrolment database is stored. I can't seem to connect even though there are no errors... any suggestions?


Average of ratings: -
In reply to John Reese

Re: Connection to Oracle database via php

by John Reese -

I finally got this working ... at least to connect and show the record set

My problem is now why when I try to a sync via command line nothing happens =( no errors.. nothing

am i missing a configuration somewhere?

In reply to John Reese

Re: Connection to Oracle database via php

by Phil Loaiza -

If you are using  /enrol/database/cli/sync.php you can run it from the command line with  "php sync.php -v" which will give you verbose progress information . . . but don't expect much.  It was worthless to me.  I ended up putting a bunch of error_log( "informative progress note") statements into the code to finally figure out why my external database enrolment stuff wasn't working.

In reply to Phil Loaiza

Re: Connection to Oracle database via php

by Hittesh Ahuja -

i guess mtrace($string) does that for you... print verbose info in CLI...

In reply to Hittesh Ahuja

Re: Connection to Oracle database via php

by John Reese -

Hittesh... how do I do this?

Please clarify

In reply to John Reese

Re: Connection to Oracle database via php

by Hittesh Ahuja -

to debug your external connection problem, you can use mtrace($string) in the php code to trace the error. what mtrace does is shows the output on the screen when running the php script from the cli. it also has the option to add seconds to it, that will hold the message on the string for that long.

For eg;

mtrace("This is where i am right now",50); will hold the msg for 50 seconds

For more usages of mtrace, refer the file lib.php in the database folder under enrol.

Hope this is clear.

Hittesh