Ben Mabrouk Mohamed Ben Mabrouk Mohamed - 5 months ago 9x
PHP Question

Connecting to Oracle Database 11g using PHP code

I am trying to develop a web application with php that will connect to an 11g oracle database.

Here is my code:

//database parameter
$db_name = "my_base";
$user = "username";
$password = "password";
$sid = "sid_number";
$port = "1521";

//function of connection
$conn = oci_connect ($user, $password, "//localhost/".$db_name);

Is the connection line correct? Also I'm not introducing the port number and
. Can someone tell me if the port number and
are required or not?


Your connection string is correct it's not required port number & service number but if aren't able to connect & you changed the default setting you can always add port number & service in your connection string like this [//]host_name[:port][/service_name][:server_type][/instance_name] read more from here