Oracle XE with PHP

Oracle XE


  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
  4. Start the enterprise manager control agent type: emctl start
  5. Start the enterprise manager dbconsole  type: emctl start dbconsole

Getting started


Oracle Block Edit


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;


PHP Oracle

Oracle instant Client with oci8 extension

  1. Download oracle-instantclient-basic-
    • from Oracle Technet
  2. Download oracle-instantclient-devel-
  3. Optionally also download oracle-instantclient-sqlplus-
  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


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/ \
    • --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 module just created to /usr/lib/php/modules
    • cp /home/oracle/Download/oci8/php-5.2.4/ext/oci8/modules/ /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