title: Can't connect to oracle database from php
body: <p>I'm having problem connecting to mydatabase from php. I can connect with no problems from my C# code like that:</p>
  
  <pre><code>    private void test()  
      {
          string connect = "Driver={Microsoft ODBC for Oracle};CONNECTSTRING=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=XE)));Uid=user;Pwd=pass";
          string queryString = "DELETE FROM myTabel";
  
          using (OdbcConnection connection = new OdbcConnection(connect))
          {
              try
              {
                  OdbcCommand command = new OdbcCommand(queryString, connection);
                  command.Connection.Open();
                  command.ExecuteNonQuery();
                  connection.Close();
                  log.Debug("Lokalni podatki pobrisani!");
              }
              catch (Exception e)
              {
                  Console.WriteLine("ne dela" + e.ToString());
                  deluje = false;
              }
          }
      }
  </code></pre>
  
  <p>and that realy delete all data because i check with oracle SQL Developer with which i have no problem connecting to. 
  But when i try to run that code:</p>
  
  <pre><code>          $tnsname = '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
          (CONNECT_DATA = (SERVICE_NAME = XE)))';
      }
  
      $db['default']['hostname'] = $tnsname;
       $db['default']['username'] = "esz";
        $db['default']['password'] = "test";
        $db['default']['database'] = "esz";
       $db['default']['dbdriver'] = "oci8";
       $db['default']['dbprefix'] = "";
        $db['default']['pconnect'] = FALSE;
       $db['default']['db_debug'] = TRUE;
       $db['default']['cache_on'] = FALSE;
       $db['default']['cachedir'] = "";
       $db['default']['char_set'] = "utf8";
       $db['default']['dbcollat'] = "utf8_general_ci"; 
  
    echo 'Trying to connect to database: ' .$db['default']['database'];
    $dbh=mysql_connect( $db['default['hostname'],$db['default'['username'],$db['default']['password'])
     or die('Cannot connect to the database because: ' . mysql_error());
  </code></pre>
  
  <p>I get those errors:</p>
  
  <pre><code> mysql_connect() [function.mysql-connect]: php_network_getaddresses: getaddrinfo failed: No such host is known. 
   mysql_connect() [function.mysql-connect]: [2002] php_network_getaddresses: getaddrinfo failed: No such host is kn (trying to connect via tcp://(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = XE))):3306)
   php_network_getaddresses: getaddrinfo failed: No such host is known.
  </code></pre>
  
  <p>In line where i try to excecute mysql_connect().</p>
  
  <p>Thank u all for any help!</p>