Jump to content

Php - Oracle connection


inka

Recommended Posts

Hello.

 

I am trying to connect my php page to an Oracle database, without success until now.

I tried everything I could find on google, but nothing....

 

We have enabled oci8 in php:

oci8
OCI8 Support enabled
Version 1.4.7
Revision $Id: bf2eaf558b050b6d2e6d098bed6345af7e842ea4 $
Active Persistent Connections 0
Active Connections 0
Oracle Run-time Client Library Version 11.2.0.3.0
Oracle Instant Client Version 11.2
Temporary Lob support enabled
Collections support enabled
Directive Local Value Master Value
oci8.connection_class no value no value
oci8.default_prefetch 100 100
oci8.events Off Off
oci8.max_persistent -1 -1
oci8.old_oci_close_semantics Off Off
oci8.persistent_timeout -1 -1
oci8.ping_interval 60 60
oci8.privileged_connect Off Off
oci8.statement_cache_size 20 20

 

I tried the following connection attempts - 3 versions (the server is not on the same machine as the oracle db):

<?php

//Putenv("NLS_LANG=SPANISH_SPAIN.WE8ISO8859P15");
$db="(DESCRIPTION=
 (ADDRESS_LIST=
 (ADDRESS=(PROTOCOL=TCP)
	 (HOST=$GLOBALS[192.168.1.102])(PORT=$GLOBALS[1521])
 )
 )
 (CONNECT_DATA=(SID=$GLOBALS[***]))
)";
$conn = OCILogon($GLOBALS['user'],$GLOBALS['pass'],$db);

if (!conn)
{
$e=oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
echo $e;
echo "dfsdf<br />";
return FALSE;
}
else
echo "success";
return $conn;
}
/*
$db='(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.102)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ***)
)
)';
$connection = oci_connect('user', 'pass', $db);
if (!$connection) {
$e = oci_error();
echo htmlentities($e['message']);
} */
?>
<?php
/*
function oracle_connect()
{
$user='user';
$pwd='pass';
$server='192.168.1.102'; // or ip
$port='1521';
$sid='****'; // service name
$charset='WE8ISO8859P1'; // change to whatever is needed

$conn=oci_connect($user,$pwd,'//'.$server.':'.$port.'/'.$sid,$charset);
if (!conn)
{
$e=oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
echo $e;
echo "dfsdf<br />";
return FALSE;
}
else
echo "success";
return $conn;
}
$s = oci_parse($conn, "select * from 303"); */
?>

 

I get only a blank page! I`m not an IT guy but I can work well with PHP and MySQL...but Oracle gives me headaches...

Any ideas? Anyone?! :)

Edited by inka
Link to comment
Share on other sites

  • 3 weeks later...
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.