3

I have tried to make oci_connect work, by following these directions, but I still get the error:

ora-24408 could not generate unique server group name in test.php

Here is my PHP snippet (with bogus IP):

   $tns2 = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 123.123.123.123)(PORT = 1521)) (CONNECT_DATA = (SID = foo)))";
   if ($conn = oci_connect("username","pwd", $tns2))
   {
       echo "Connected to foo";
       oci_close($conn);
   }
   else
   {
       die("could not connect to foo");
   }

I use SQL Developer and can connect to this database just fine from this Ubuntu server. I also have Java applications that connect from this Ubuntu server to the remote Oracle database without any problems.

What am I missing to make PHP work?

I even did the phpinfo() and it showed the oci8 information.

2
  • This is unrelated to what you're asking about but I'm assuming you made a typographical error when you typed: (PROTOCAL = TCP) - I'm assuming you meant (PROTOCOL = TCP). Commented Jun 13, 2013 at 20:26
  • good eyes... yes I made a typo in my post Commented Jun 13, 2013 at 20:36

2 Answers 2

6

Take a closer look to oci_connect.

And try with this conection string: "123.123.123.123:1521/foo"

$conn = oci_connect("username","pwd", "123.123.123.123:1521/foo");

Hope it helps.

Sign up to request clarification or add additional context in comments.

3 Comments

nope tried that too... still get error ora-24408 could not generate unique server group name in test.php line 75
@Dean-O, Check on this Answer.
bingo, that did the trick... no /etc/hosts entry and also no file sysconfig/nextwork
0

You can try something like this:

define ('DB_USER','username');
define ('DB_PASS','pwd');
define ('DB_HOST', '123.123.123.123');
define ('DB_NAME', 'YOUR_DATABASE_NAME');
define ('CONST_DB_CHARSET_FOR_CONNECT','WE8ISO8859P15');
define ('DB_CONNECTION_STRING','\\123.123.123.123/DBSCHEMA');//in localhost use ''


$conexion = oci_connect(DB_USER, DB_PASS,DB_CONNECTION_STRING,CONST_DB_CHARSET_FOR_CONNECT);

Just put the right value for: YOUR_DATABASE_NAME that's how I connect to remote oracle 11.g database.

Hope this helps you.

1 Comment

What is your define for DB_CONNECTION_STRING

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.