Oracle Support for PHP

This section describes how configuring PHP to be able to connect to an Oracle server using oci8.

I first tested to use PDO_OCI (which should be compiled as for oci8 but first requires that you issue a pecl install PDO). However after lots of debugging, I could not make it work properly with TYPO3 as I had errors from AdoDB:

Dictionary driver ’/var/www/typo3_src-trunk/typo3/sysext/adodb/adodb/datadict/’ not available

Furthermore, after digging into DBAL’s code, there is code strictly testing oci8 (e.g., to dynamically replace the ’&’ (bitwise AND) operator to the Oracle-specific function, in typo3/sysext/dbal/class.ux_t3lib_sqlparser.php).

As such, I’m now using oci8. You need to have either the Oracle server locally or the Oracle client installed in order to be able to compile the oci8 module.

Installing oci8 on Debian Lenny

Compile the oci8 module against your version of PHP5:

# cd /tmp
# apt-get source php5
# cd php5-5.2.6.dfsg.1/ext/oci8/
# pecl install package2.xml

Create file /etc/php5/conf.d/oci8.ini:

# configuration for php OCI8 module

Make sure it works:

# php -m | grep oci8

It’s time to restart Apache:

# /etc/init.d/apache2 restart

Installing oci8 on Red Hat Enterprise Linux 5

As time of writing, Red Hat Enterprise Linux 5 officially supports only PHP 5.1.6. First thing to do is to upgrade to PHP 5.2.x.

This section of the tutorial is adapted from  [1] to work on Red Hat Enterprise Linux 5 64 bits.

Get and install latest release of PHP 5.2:

# wget
# wget
# rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm
# yum --enablerepo=remi update php php-\*

Install oci8 module for PHP:

# yum --enablerepo=remi install php-oci8

Fixing Issues

As I had to dig a bit to fix a few issues, here is what I had to do…

[Problem 1] Showing the loaded modules gives us an error:

# php -m
PHP Warning:  PHP Startup: Unable to load dynamic library ’/usr/lib64/php/modules/’ -
/opt/oracle/product/11.1.0/client/ cannot restore segment prot after reloc:
Permission denied in Unknown on line 0

This is the error due to SE Linux running in Enforce mode. The best way to avoid this is to make the SE Linux in Permissive mode. Change this by running:

# system-config-securitylevel

[Problem 2] Cannot load

Create file /etc/


run ldconfig:

# ldconfig

and restart Apache.



Causal Sàrl - Development, TYPO3, Consulting