Oracle XE with PHP

Oracle XE

Installation

  1. DownLoad and install the Oracle XE rpm
  2. As root run /etc/init.d/oracle-xe configure
    • Answer the configuration questions, remember the password.
  3. Open your browser to 127.0.0.1:8080/apex
  4. Start the enterprise manager control agent type: emctl start
  5. Start the enterprise manager dbconsole  type: emctl start dbconsole

Getting started

Tuning

Oracle Block Edit

Nologging

Chained Rows

create table CHAINED_ROWS ( owner_name varchar2(30), table_name varchar2(30), cluster_name varchar2(30), partition_name varchar2(30), subpartition_name varchar2(30), head_rowid rowid, analyze_timestamp date );

analyze table test list chained rows into chained_rows;

SQLNet

PHP Oracle

Oracle instant Client with oci8 extension

  1. Download oracle-instantclient-basic-10.2.0.3-1.i386.rpm
    • from Oracle Technet
  2. Download oracle-instantclient-devel-10.2.0.3-1.i386.rpm
  3. Optionally also download oracle-instantclient-sqlplus-10.2.0.3-1.i386.rpm
  4. Install the rpm packages
    • rpm –ivh packagename
  5. Upgrade the packages
    • rpm –Uvh packagename
  6. Create a /etc/tnsnames.ora file

 

Oracle XE

If using Oracle XE then add the following to /etc/rc.d/rc.local file

ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/
ORACLE_SID=XE
export ORACLE_HOME ORACLE_SID
export

Build oci8

  1. Download php-5.2.4.tar or the version of your php
  2. Uncompress php-5.2.4
  3. Change to the php-5.2.4 directory you downloaded earlier
    • $ cd <your-download_path>/oci8/php-5.2.4/ext/oci8
  4. Run phpize
    • $ phpize
  5. Run configure
    • ./configure --with-oci8=instantclient,/usr/lib/oracle/10.2.0.3/client/lib \
    • --prefix=$HOME/php --with-apxs=$HOME/apache/bin/apxs \
    • --enable-sigchild --with-config-file-path=$HOME/apache/conf
  6. Run make
  7. Create a oci8.ini
    • cp /etc/php.d/pdo.ini /etc/php.d/oci8.ini
    • Edit the file changing the extension from pdo to oci8
  8. Copy the oci8.so module just created to /usr/lib/php/modules
    • cp /home/oracle/Download/oci8/php-5.2.4/ext/oci8/modules/oci8.so /usr/lib/php/modules
  9. Restart Apache server /etc/rc.d/init.d/httpd restart
  10. Test oci8 by creating a file named Oracletest.php like this in your web root
  11. If you get that means you need to start your oracle database and or unlock the hr user
    • Type http://localhost:8080/apex to get to the Oracle XE login

Subject