How to set up OCI to connect to Oracle from PHP?

Active3 hr before
Viewed126 times

5 Answers


Install Apache and enable UserDir module for public_html , Install Oracle Database 11.2 , Create a user named PHPHOL with password of 'welcome'. Install Oracle's sample HR schema and make the following changes:, Start DRCP connection pooling:

Start DRCP connection pooling:

sqlplus / as sysdba
execute dbms_connection_pool.start_pool();
execute dbms_connection_pool.restore_defaults();
load more v

oci_pconnect() - Connect to an Oracle database using a persistent connection, An incorrectly installed or configured OCI8 extension will often manifest itself as a connection problem or error. See Installing/Configuring for troubleshooting information. ,oci_new_connect() - Connect to the Oracle server using a unique connection,Passing this parameter can reduce the time taken to connect.

load more v

Forth link in google after searching for your exact questions brought up the following link:,Its unclear from your question if you want to configure your PHP install to connect to oracle or if you just want the php syntax to make the connection?, Reconnecting with a previous professor then asking right away for a reference letter ,PHP provides Oracle OCI8 functions. Other options are PDO with the Oracle Driver and (if oracle supports it) ODBC.

Forth link in google after searching for your exact questions brought up the following link:

< ? php

if ($c = OCILogon("system", "your database password", $db)) {
   echo "Successfully connected to Oracle.\n";
} else {
   $err = OCIError();
   echo "Connection failed.".$err[text];
} ?
load more v

NOTE: For this tutorial, the installed Apache version is 2.4.10 and the installed PHP version is 5.4.36.,Instant Client Package - SDK,Instant Client Package - Basic,Instant Client Package - SQL*Plus

.├──BASIC_README├── SQLPLUS_README├── adrci├── genezi├── glogin.sql├── libclntsh.dylib .11 .1├── libnnz11.dylib├── libocci.dylib .11 .1├── libociei.dylib├── libocijdbc11.dylib├── libsqlplus.dylib├── libsqlplusic.dylib├── ojdbc5.jar├── ojdbc6.jar├── sdk│├── SDK_README│├── demo│├── include│├── ott│└──├── sqlplus├── uidrvci└── xstreams.jar
load more v

1.3 Set up your Oracle extension,1 Installing Moodle on Windows with Oracle Express Edition 1.1 Introduction 1.2 Install Oracle 1.3 Set up your Oracle extension 1.4 Install Moodle 1.5 Configure Apache ,I needed to test an installation of Oracle with Moodle, here's what I did ,Download Oracle Express Edition on Oracle web site.

Log out of Chrome before doing this bit though because Chrome uses the same folder and it will instantly crash.

sudo rm - rf / dev / shm
sudo mkdir / dev / shm
sudo mount - t tmpfs shmfs - o size = 4096 m / dev / shm
load more v

Other "connect-undefined" queries related to "How to set up OCI to connect to Oracle from PHP?"