Hey guys, can someone please tell me how I can connect to a remote Oracle DB using WAMP (Windows Apache MySQL PHP) installed locally on my machine?

Dani AI

Generated

Short expert summary and practical steps that expand on earlier replies from , and .

WAMP can connect to a remote Oracle database, but PHP needs Oracle client libraries plus the OCI8 (or PDO_OCI) extension to talk to Oracle. That means a local Oracle server is not required (so installing a full DB is optional, as noted), but a client install on the WAMP machine is normally necessary — contrary to the suggestion that "no extra software" is needed. Once the Oracle client is present and the PHP extension is enabled, a connection string (as asked about) or an EZCONNECT DSN will let PHP query the remote instance.

Minimal practical checklist:

  • Install Oracle Instant Client (match the exact PHP/Apache architecture: 32-bit vs 64-bit).
  • Add the Instant Client directory to the Windows PATH (and set TNS_ADMIN if using tnsnames.ora).
  • Enable OCI8 or PDO_OCI in php.ini (extension filename can vary by PHP version).
  • Restart Apache and verify oci8 appears in phpinfo().

Example connection patterns (replace credentials and host):

// OCI8 (procedural)
$conn = oci_connect('USER', 'PASS', 'dbhost.example.com:1521/ORCL');
$stid = oci_parse($conn, 'SELECT * FROM my_table');
oci_execute($stid);
while ($row = oci_fetch_assoc($stid)) { print_r($row); }
oci_free_statement($stid);
oci_close($conn);

// PDO (OCI)
$dsn = "oci:dbname=//dbhost.example.com:1521/ORCL";
$dbh = new PDO($dsn, 'USER', 'PASS');

Troubleshooting notes: common problems are mismatched bitness (PHP vs Instant Client), missing Visual C++ runtime, "unable to load" php_oci8.dll, ORA-12154 (TNS name issues), and firewalls blocking port 1521. Use EZCONNECT (host:port/service) to avoid tnsnames.ora while testing, confirm reachability to the listener (telnet host 1521), and include phpinfo() output and Apache error-log excerpts when diagnosing further.

Recommended Answers

All 5 Replies

are you looking for the connection string ?

yeah that would be great, do i ahve to download any additional software to connect to the oracle db?

No need to install addition software for database connection .
please find the details of connection string here.

what if i want to execute sql queries and pull them back to the php file so i can display the results on a web page?

thanks very much for your help!

2eXtreme,
Have you downloaded any version of the oracle database (oracle 10g, and recently 11g)?
I use the oracle 10g express edition installed on my local PC to connect to my database. you can download any version by first hooking up to the oracle.com website, register and then dowload and install the database (either 10g or 11g version) to your PC. do so and let the forum know what to do next. Hope this does something?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.