Apache and PHP with Oracle Database

Apparently, Apache and PHP need an extra plugin to handle connections with an external Oracle Database. This Plugin is called „oci8“ and is installed as an option with PHP.

There are several ways to install oci8 plugin, on my ubuntu test system, I chose an easy one:

  • download instantclient-basic
  • download instantclient-sdk from the oracle website
  • unzip both
  • set some symlinks to the file with extension *.so.1.11 e.g. in the same directory
  • libocci.so -> libocci.so.*
  • libclntsh.so -> libclntsh.so.*
  • run „ldconfig“
  • install „pecl“ if not done so far
  • run „pecl install oci8“ (if everything is in the right place, it will finish without an error)
  • get the „libaio-dev“
  • in the php.ini file in your PHP folder, add an extra line with „extension=oci8“ under the extensions area

After restarting your apache, you should now be able to connect to an Oracle database using oci8.