Forum Stats

  • 3,826,761 Users
  • 2,260,705 Discussions


Unable to connect Php5.3 with Oracle 11gR2 on NetBeans 7.4

Prince Gupta
Prince Gupta Member Posts: 1
edited Feb 27, 2014 4:07PM in PHP



on "tnsping service_name" getting an error "Failed to resolve the name"



->OS Name Microsoft Windows 7 Enterprise

   Version 6.1.7601 Service Pack 1 Build 7601

->PHP 5.3 & tried with  5.4

->Oracle 11gR2

->NetBeans 7.4

->Oracle instant client 11_2 32 bit & tried with 64 bit as well

->Xampp server 1.8 & tried with lower version also.

->path location of instant client : C:\Windows\SysWOW64

->environment variable: C:\Windows\SysWOW64\instantclient_11_2



-> tried to do tnsping with service name and alias name also, getting failed to resolve name.

-> port 1521 is listening.

-> firewall is turned off.

-> tried to change the port from 1521 to 1527 but getting same error.

-> checked the registry and found correct entries for tns_admin and oracle_home.

-> tried to change the service name as well, no success.

-> changed the sid name to service name in tnsnames.ora file, no success.

-> restarted the listener service several times, no success.

-> system is rebooted various times after setting environmental vaiable for instant  client.

-> localhost is resolved by IP.

-> checked the trace file of tnsping, found nothing special.

-> checked the log file of tnssping and found following error:-

          TNS-12542: TNS:address already in use

           TNS-12560: TNS:protocol adapter error

            TNS-00512: Address already in use

             64-bit Windows Error: 48: Unknown error

Please help, we are struggling with this issue since last two weeks, and we are in mid of our project.

Thanks in advance.

Prince Kumar

Citrix R&D



  • Christopher Jones-Oracle
    Christopher Jones-Oracle Member Posts: 1,648 Employee
    edited Jan 30, 2014 11:59AM

    I see a few issues or potential issues:

    1. Using Windows. If your application will eventually be deployed on Linux, then you really need to develop it on Linux due to various differences in the way PHP works on the platforms. It's also commonly suggested that PHP is slower on Windows.  There are also issues with some important PHP extensions on Windows.  If you don't have a native Linux machine, then use to create a VM.

    2. Using a tnsnames.ora file.  Why not use the Easy Connect connection string format "hostname/servicename" that doesn't require any local configuration file? This removes one point of failure because you don't have issues making sure Oracle libraries can locate and read the tnames.ora file.  (For the syntax, see PHP: oci_connect - Manual or my book The Underground PHP and Oracle Manual)

    3. Nothing in your question involves PHP or Netbeans.  Since tnsping fails, you have a basic network or Oracle client installation issue.  This needs to be resolved first, before looking at PHP (though make sure to use the correct 32 or 64 bit as required by Xampp).  See the next point for what I suspect is the problem.

    4. Your list mentions Oracle 11.2 and Instant Client as separate items.  If you already have a DB on the machine, then you don't need Instant Client (unless there are 32 vs 64 bit issues).  Having multiple sets of Oracle libraries on Windows is a common source of user errors due to library clashes.  Clean up the machine and check connection using SQL*Plus from the DB home.

    5. In the last few months Windows PECL extensions have become more easily accessible from extension pages, so the need for bundles like Xampp has decreased. It might be easier to install Apache and PHP separately. See

  • 2621890
    2621890 Member Posts: 1
    edited Feb 27, 2014 4:07PM

    Warning: oci_connect() [function.oci-connect]: ORA-12541: TNS:no listener
    how can i solve this problem??

This discussion has been closed.