Jump to content


Photo

Php - Oracle connection

php oracle

  • Please log in to reply
1 reply to this topic

#1 inka

inka

    Newbie

  • Members
  • Pip
  • 4 posts
  • LocationTransilvania

Posted 20 February 2013 - 04:16 AM

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, 20 February 2013 - 04:21 AM.


#2 Jonesi

Jonesi

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 09 March 2013 - 12:14 PM

Do you get any errors in your php_error.log?

 

Check 'The Underground PHP and Oracle Manual' for detailed information about Oracle connections: http://www.oracle.co...al-098250.html 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com