cannot connect to oracle database

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Mon Apr 28, 2014 11:32 pm

cannot connect to oracle database

Postby nicolealcock » Mon Apr 28, 2014 11:43 pm

I am a newby on php..I need to connect to validate username and password to an oracle database... I've used the following code:

function my_error_handler($errno, $errstr, $errfile, $errline) {
if (preg_match('/ORA-28002: [ a-zA-Z]*([0-9])+/', $errstr, $matches)) {
echo "Your password will expire within ${matches[1]} days\n";

set_error_handler("my_error_handler", E_WARNING);

$c = @oci_connect("flt_admin", "fad01", "");
echo "hell0 world";
if (!$c) {
$m = oci_error();
echo "Connection failed: " . $m['message'] . "\n";
} else {
echo "Connected OK\n";
// Prove the connection is valid
$s = oci_parse($c, "select 'Query is OK' as c from dual");
$r = oci_fetch_array($s, OCI_ASSOC);
echo $r['C'] . "\n";


When I run it I get no error messages just a blank screen. Can someone please tell me where I am going wrong. I have amended php.ini file to connect to

Return to “PHP coding => General”

Who is online

Users browsing this forum: Baidu [Spider] and 9 guests